Luke Treadwell AI Systems / Real Estate Finance

refi-leads

A lead system for multifamily refinance that ranks loans by when the refinance conversation is worth having, then works from the LLC on title back to the person who takes the call.

Industry
Commercial real estate finance
Role
Architect and builder — sole
Status
Live since June 2026, in beta, actively improved
Stack
Next.js 16 · Prisma 7 / Neon Postgres · Auth.js v5 · Inngest v4
Timeline
Multi-week
~10,800Lines of TypeScript
190Tests
20API routes

The problem

Every multifamily loan carries a maturity date, the day the balance comes due and the owner has to pay it off or refinance, and that date is on record years ahead. An export of commercial mortgages shows which notes come due next year, so finding the loan is the easy part.

The hard parts come after. The borrower named on the note is almost always an LLC, and an LLC has no phone number, so the owner who signs sits behind an entity the record never names. The second difficulty is quieter: a broker will ask why one borrower ranks above another, and a score nobody can explain is a score nobody acts on.

Constraints

Ownership hides behind entities: title is held by an LLC, that LLC is often owned by another, and the chain down to a person is not published anywhere.

Contact data is bought, not looked up. Enrichment, the step that attaches a phone number to a lead, runs through a paid service that charges per request, so enriching everything on import is off the table: a lead has to earn its lookup, and results are cached so the same owner is never paid for twice.

The product is multi-tenant, meaning several teams share one installation and database, so every read and write is scoped to the workspace that owns the row and no team sees another's leads. Nobody asks for that as a feature, but the schema has to satisfy it from the first migration, since retrofitting means auditing every query.

How it works

CoStar and RCA, two commercial real estate data providers, export loan data as spreadsheets that are parsed into leads. Each lead then carries a score built from three signals, and only three: maturity, LTV headroom, and portfolio. Maturity, how soon the loan comes due, carries a weight of 0.60, because closeness to that date is what creates the conversation. LTV headroom is loan-to-value headroom, the gap between what the building is worth and what is owed on it, which is the room left to borrow more. Portfolio is how many buildings the owner holds. Three is what a person can hold in their head on a call, and that mattered more than accuracy.

Scored leads are worked like any CRM record, moving across a kanban pipeline and carrying follow-up tasks assigned to individual people. Enrichment runs apart from that, as background jobs: lookups are queued and run outside the web request, so nobody waits on a page. A lead with a mailing address goes to a skip-trace service, a paid provider that turns an address or entity name into a phone number for the person behind it. EDGAR, the public database of SEC filings, is the backup and runs only when the owner is a public company, and whatever comes back merges onto the lead as a contact.

The enrichment path for one lead A lead is checked for an entity name or a mailing address. Without either it is never queued. With one, it enters an Inngest background queue that is checked against a cache before any paid lookup. From the queue, an address goes to a skip-trace service; EDGAR is the backup and runs only when the owner name belongs to a public company. Either result merges onto the lead and becomes a contact. lead Inngest queue skip-trace service merge onto lead entity or address present? contact cache checked before spend EDGAR backup · public companies address lookup yes public co. no · not queued
One lead through enrichment. Lookups cost money, so the gate and the cache make sure nothing is bought twice or bought on a lead with nothing to look up.

Decisions that mattered

The rate-gap subscore was deleted

An earlier version compared each loan's rate against current market rates and rewarded the gap, which measured the wrong thing. A refinance conversation is driven by when the loan was written and when it comes due, since a note reaching maturity forces something to happen, not by whether today's rate is favorable. The subscore was removed and its weight folded into maturity, since four signals only looked more careful than three.

The Secretary-of-State scrapers were removed entirely

Every state publishes a registry of the businesses filed in it, and three states' worth of scraping against those registries came out, not disabled but deleted. Two enrichment sources replaced them, and what the system promises narrowed to match. Nothing technical forced it, since the scrapers could have kept running: it was a judgment about how much coverage to maintain.

Parser dispatch order

Two export formats come in, and the parser tells them apart by signature, the column headers that identify the provider. CoStar's signature is three specific headers, which is strong, while RCA's is weak enough to match files that are not its own, so CoStar is tested first. Reverse the order and the weak test wins on files owned by the strong one, and nothing throws: the wrong columns import silently.

What broke

A cap rate, a property's annual income stated as a percentage of its value, rendered as 570% instead of 5.7% because the value arrived as a decimal and the formatter treated it as already a percentage.

An owner-name filter meant to separate people from companies quietly dropped real people named Vincent, Quincy, and Ralph. The casualties explain themselves once you look at the letters: Vincent and Quincy contain inc, Ralph contains lp, and the filter was matching legal-entity tokens anywhere inside a name rather than as whole words.

The enrichment cache stored failed lookups the same way it stored real answers, for ninety days, so one network failure became three months of the system insisting no contact existed. A failure and an empty result are not the same thing, and a cache that cannot tell them apart holds the wrong one longest.

Background jobs registered against the cloud service instead of the local development server, so they were dispatched somewhere real, just not anywhere that could run them: nothing ran and nothing errored in development.

The last one came out of an adversarial review pass, a separate look for what the build missed. The endpoint that assigns a task took the assignee from the browser without checking that the person named belonged to the workspace, so the boundary the whole schema was built around went unenforced at that one write. It was caught before launch and fixed structurally: every write now scopes to its workspace, not just the endpoint that was wrong, then verified. The story is that the review pass existed and did its job.

Where it stands

The system went live in June 2026 and is still in beta, with active work in the unglamorous half: enrichment coverage, import parsers, and scoring weights. The weights in particular are not finished and should not be, because the only real feedback on a scoring model is which calls proved worth making, and that arrives in quarters.

What it's worth

No outcome data exists yet and none will for a while, so what follows is a claim, not a result.

Refinance outreach tends to be reactive: a broker hears something, or the borrower calls first, and a maturity sometimes surfaces only once it is too late, though the date was knowable all along. Putting those dates in order lets the calendar drive the calls instead of the phone, which is the first thing the system is for.

The second is defensibility. Every score decomposes into three numbers a person can say out loud: maturity, LTV headroom, and portfolio. When someone asks why a borrower sits at the top, there is an answer, and hearing it does not require trusting the model.

← All projects