Atris

Qualify inbound leads against written criteria.
Done by an agent. Checked twice.

Every new lead is checked and scored against your written criteria, so sellers call the right ones first.

Have Atris do this for you›

1

Real files in

  • leads.csv
    Forty-five leads from one week of web forms, with repeats, blank fields, personal mail addresses and numbers typed in odd ways. 46 lines, 8 KB.
  • qualification_criteria.md
    One company's written rules for sorting new leads: three gates, a points table and the score each status needs. 71 lines, 2 KB.

Sample data written by Atris. Not a real company.

2

Three steps

  1. 1.Read the criteria and the leads
  2. 2.Decide every lead
  3. 3.Write the decisions and the handoff

Claude Sonnet 5.5, 42 seconds. No web. It never saw the check.

3

Checked twice

  • ✓Passed: 45 of 45 leads appear once in lead_decisions.csv
  • ✓Passed: 45 of 45 statuses equal the status recomputed from the criteria
  • ✓Passed: 32 of 32 scores equal the points added up again from the table and 13 of 13 unscored leads have no score
  • ✓Passed: 10 of 10 qualified leads go to the right desk and no other lead is sent to one
  • ✓Passed: handoff.md gives the right count for 6 of 6 statuses
  • ✓Passed: handoff.md lists 10 of 10 qualified leads with the right score and desk, highest score first
  • ✓Passed: handoff.md names 3 of 3 leads that need more facts
  • ✓Passed: 18 of 18 numbers in handoff.md are a status count, the number of leads or a figure from the row of a lead named on that line
  • ✓Passed: 310 of 310 numbers in the reasons come from the lead's own row, its own points or the criteria

Second review by Claude Opus 5.5: pass.

Then we broke a copy of the output 6 ways on purpose. The check caught 6.

What it wrote. Lines 1 to 12 of lead_decisions.csv, copied from the file.
lead_id,status,score,route_to,reason
L-2401,nurture,60,,Score 60 = vehicles 30 (25) + role Director (20) + timeline Just looking (0) + employees 180 (10) + source Referral (5).
L-2402,qualified,85,Americas desk,Score 85 = vehicles 75 (25) + role Owner (25) + timeline Within 1 month (20) + employees 160 (10) + source Referral (5).
L-2403,low_priority,40,,Score 40 = vehicles 6 (10) + role Director (20) + timeline Just looking (0) + employees 24 (5) + source Referral (5).
L-2404,disqualified,,,Gate 3: email is at personal mail domain gmail.com.
L-2405,qualified,80,Pacific desk,Score 80 = vehicles 75 (25) + role Owner (25) + timeline Within 1 month (20) + employees 150 (10) + source Web form (0).
L-2406,nurture,60,,Score 60 = vehicles 12 (10) + role Owner (25) + timeline 1 to 3 months (15) + employees 24 (5) + source Referral (5).
L-2407,disqualified,,,Gate 3: country Germany is not one we serve.
L-2408,nurture,52,,Score 52 = vehicles 75 (25) + role Manager (12) + timeline Just looking (0) + employees 150 (10) + source Referral (5).
L-2409,nurture,62,,Score 62 = vehicles 90 (25) + role Manager (12) + timeline 1 to 3 months (15) + employees 270 (10) + source Web form (0).
L-2410,disqualified,,,Gate 3: email is at personal mail domain outlook.com.
L-2411,qualified,70,Americas desk,Score 70 = vehicles 140 (35) + role Manager (12) + timeline 3 to 6 months (8) + employees 210 (10) + source Referral (5).

How this was run

An AI agent on Claude Sonnet 5.5 was given a folder with the files below and a three-step flow, and nothing else. It had no web access and never saw the check. The check was written before the run and made stricter after it. It works the answer out again from the input files. Then Claude Opus 5.5 reviewed the result against the inputs. The input files are sample data written by Atris, with the problems a real week has planted in them.

Run 2 of 2 on 1 December 2026. The agent took 42 seconds. Run 1 passed both checks and the job was run again later. Each run starts clean. Between runs the written flow was made clearer, or a check was corrected or made stricter. Nobody edits the output.

What the second review verified

  • Worked out all 45 leads by hand because the script was blocked. Every status, score and desk matches, e.g. L-2415 = 35+25+20+15+5 = 100 Americas desk, L-2420 = 25+5+0+10+5 = 45 nurture, L-2423 (employees '250+' read as 250) = 25+20+15+10 = 70 Europe desk
  • Duplicates after ignoring capitals and spaces: L-2428 repeats L-2402 (' Devon.Okafor@PinebrookBeverage.example '), L-2432 repeats L-2415 (SABINE.kowalczyk@Dovecotemealkits.example), L-2435 repeats L-2421. No other emails repeat
  • Gates applied in order: needs_info for L-2421 (vehicles blank), L-2426 (country blank) and L-2434 (employees blank). Seven disqualified, each with the first reason that applies: 2404 gmail.com, 2407 Germany, 2410 outlook.com, 2413 Student, 2418 New Zealand, 2424 3 vehicles, 2442 4 vehicles
  • The handoff counts (10 qualified, 18 nurture, 4 low_priority, 3 needs_info, 7 disqualified, 3 duplicate = 45) match the decisions file and the 45 input rows. The qualified list is ordered 100, 95, 85, 85, 82, 80, 78, 70, 70, 70 with the right desks

What this run does not show

  • The 45 leads and the criteria were written by Atris for this run. Real inbound leads are messier and criteria are rarely this complete.
  • The reason sentences are tested only for their numbers. Whether a reason reads well is judged by the second review alone.
  • Run 1 passed too. Run 2 exists only because two commas were taken out of the flow afterwards.

Would the check catch a wrong answer?

A check that cannot fail proves nothing. After the run we took a copy of the output, broke it one small way at a time and ran the check again. It caught 6 of 6. The check was made stricter after the first try at this, and the same untouched output was graded again.

Open every file

flow.md · the three steps the agent followed
# Qualify inbound leads against written criteria

function: sales
for: the person who decides which new leads a seller calls first
goal: Every new lead has one status, a score where the criteria allow one and a reason anyone can trace back to the written criteria.

## 1. Read the criteria and the leads
Read input/qualification_criteria.md from top to bottom, then input/leads.csv. The criteria file is the
only rulebook. It says how to read messy fields, which gates come before scoring and in what order,
how points are added and which score earns which status. Do not add rules of your own and do not skip
a gate because a lead looks good.

## 2. Decide every lead
Take the leads in submitted_at order. Put each one through the gates in the order the criteria give.
A lead stopped by a gate gets that gate's status and no score. A lead that passes every gate gets its
points added up and the status the criteria give for that score. Use the status words exactly as the
criteria write them.

## 3. Write the decisions and the handoff
Write output/lead_decisions.csv with columns lead_id,status,score,route_to,reason. One row per lead in
the leads file, none left out. score is a whole number, blank when the lead was not scored. route_to
is the desk the criteria name for a qualified lead, written as the criteria write it. It is blank for
every other status. reason is one plain sentence: the gate and the fact that stopped it, or the points
that made up the score.

Write output/handoff.md for the sales lead. Start with one line per status in the form
`- qualified: 7`, using every status that has at least one lead. Then list the qualified leads,
highest score first, one line each with lead_id, company, score and desk. Then list each lead that
needs more facts with the field that is blank.

## Done looks like
- Every lead in the leads file appears once in lead_decisions.csv.
- Every status and score can be worked out again from the criteria and the lead's own row.
- The counts in handoff.md equal the counts in lead_decisions.csv.
input/leads.csv · 46 lines, 8 KB
lead_id,submitted_at,name,email,company,role,country,employees,vehicles,timeline,source,message
L-2401,2026-11-23 12:26,Mara Halvorsen,mara.halvorsen@harrowgateproduce.example,Harrowgate Produce,Director,Ireland,180,30,Just looking,Referral,We added a second depot and planning got hard.
L-2402,2026-11-23 16:26,Devon Okafor,devon.okafor@pinebrookbeverage.example,Pinebrook Beverage,Owner,Canada,160,75,Within 1 month,Referral,Looking at options before our lease renewal.
L-2403,2026-11-23 18:18,Priya Lindqvist,priya.lindqvist@caldervalleydairy.example,Calder Valley Dairy,Director,United States,24,6,Just looking,Referral,
L-2404,2026-11-23 21:25,Tobias Marchetti,tobias.marchetti@gmail.com,Tidewater Linen Service,Consultant,Ireland,150,75,,Web form,We added a second depot and planning got hard.
L-2405,2026-11-24 08:39,Ingrid Abara,ingrid.abara@ostranderbuildingsupply.example,Ostrander Building Supply,Owner,Australia,150,75,Within 1 month,Web form,We route by hand on a whiteboard and it no longer works.
L-2406,2026-11-24 11:47,Callum Whitcombe,callum.whitcombe@fenwickfloralwholesale.example,Fenwick Floral Wholesale,Owner,Ireland,24,12,1 to 3 months,Referral,We added a second depot and planning got hard.
L-2407,2026-11-24 14:34,Noor Dravid,noor.dravid@quillonmedicalcourier.example,Quillon Medical Courier,Manager,Germany,280,140,1 to 3 months,Referral,We route by hand on a whiteboard and it no longer works.
L-2408,2026-11-24 17:06,Felix Sorenson,felix.sorenson@redmerebakerygroup.example,Redmere Bakery Group,Manager,UK,150,75,Just looking,Referral,Drivers keep missing delivery windows. Need a demo.
L-2409,2026-11-24 19:01,Odette Pellegrin,odette.pellegrin@saltmarshseafood.example,Saltmarsh Seafood,Manager,Australia,270,90,1 to 3 months,Web form,Drivers keep missing delivery windows. Need a demo.
L-2410,2026-11-24 21:18,Rhys Achterberg,rhys.achterberg@outlook.com,Bexley Parts Depot,Executive,Canada,150,60,3 to 6 months,Web form,We route by hand on a whiteboard and it no longer works.
L-2411,2026-11-24 22:47,Lena Nakashima,lena.nakashima@larchmontpharmacysupply.example,Larchmont Pharmacy Supply,Manager,United States,210,140,3 to 6 months,Referral,
L-2412,2026-11-24 23:40,Marcus Vance,marcus.vance@underhillpropane.example,Underhill Propane,Manager,U.S.,88,22,1 to 3 months,Webinar,Drivers keep missing delivery windows. Need a demo.
L-2413,2026-11-25 08:18,Anika Thibault,anika.thibault@marloweofficecoffee.example,Marlowe Office Coffee,Student,United States,45,12,1 to 3 months,Web form,
L-2414,2026-11-25 09:08,Joel Ferreira,joel.ferreira@whinstoneaggregates.example,Whinstone Aggregates,Director,Ireland,9,6,1 to 3 months,Web form,Saw your talk and want to learn more.
L-2415,2026-11-25 11:53,Sabine Kowalczyk,sabine.kowalczyk@dovecotemealkits.example,Dovecote Meal Kits,Executive,USA,"1,200",220,Within 1 month,Referral,
L-2416,2026-11-25 14:09,Hugo Brandt,hugo.brandt@garrickuniformrental.example,Garrick Uniform Rental,Consultant,USA,33,22,Within 1 month,Webinar,We added a second depot and planning got hard.
L-2417,2026-11-25 15:37,Tessa Oyelaran,tessa.oyelaran@halcyonwaterdelivery.example,Halcyon Water Delivery,Director,UK,30,15,Just looking,Web form,We added a second depot and planning got hard.
L-2418,2026-11-25 16:49,Kiran Castellan,kiran.castellan@ironbridgetire.example,Ironbridge Tire,Owner,New Zealand,400,140,1 to 3 months,Web form,We added a second depot and planning got hard.
L-2419,2026-11-25 19:02,Dalia Mirza,dalia.mirza@juniperlanecatering.example,Juniper Lane Catering,Executive,United States,54,18,Within 1 month,Web form,We added a second depot and planning got hard.
L-2420,2026-11-25 19:40,Emmett Holloway,emmett.holloway@kingsmereappliance.example,Kingsmere Appliance,Individual contributor,United Kingdom,150,75,Just looking,Referral,Looking at options before our lease renewal.
L-2421,2026-11-25 23:48,Greta Yilmaz,greta.yilmaz@lowfieldfeedseed.example,Lowfield Feed and Seed,Director,UK,240,,1 to 3 months,Web form,Looking at options before our lease renewal.
L-2422,2026-11-26 08:52,Omar Eastman,omar.eastman@mossgrovenursery.example,Mossgrove Nursery,Manager,Canada,30,15,1 to 3 months,Web form,
L-2423,2026-11-26 10:17,Willa Qureshi,willa.qureshi@northcliffpaper.example,Northcliff Paper,Director,Ireland,250+,90,1 to 3 months,Web form,Fuel costs are up and we need tighter routes.
L-2424,2026-11-26 11:19,Stefan Lachance,stefan.lachance@oakhavenautoglass.example,Oakhaven Auto Glass,Owner,Australia,6,3,1 to 3 months,Web form,
L-2425,2026-11-26 12:59,Nadia Brennan,nadia.brennan@pallistervending.example,Pallister Vending,Consultant,United States,360,90,3 to 6 months,Webinar,Saw your talk and want to learn more.
L-2426,2026-11-26 14:06,Corin Varga,corin.varga@quarryhillfuel.example,Quarry Hill Fuel,Manager,,12,8,Just looking,Web form,We added a second depot and planning got hard.
L-2427,2026-11-26 15:52,Bea Adeyemi,bea.adeyemi@rookwoodpetsupply.example,Rookwood Pet Supply,Manager,USA,90,60,,Web form,Drivers keep missing delivery windows. Need a demo.
L-2428,2026-11-26 16:41,Devon Okafor, Devon.Okafor@PinebrookBeverage.example ,Pinebrook Beverage,Owner,Canada,160,80,Within 1 month,Referral,Following up on my earlier request. Can someone call me?
L-2429,2026-11-26 18:21,Luka Stroud,luka.stroud@stanmoreice.example,Stanmore Ice,Manager,United States,60,15,Within 1 month,Web form,Do you integrate with our order system?
L-2430,2026-11-26 21:22,Maeve Ishikawa,maeve.ishikawa@thistledownlaundry.example,Thistledown Laundry,Director,United States,50-100,30,1 to 3 months,Web form,Please send pricing.
L-2431,2026-11-27 08:26,Idris Montrose,idris.montrose@uplandfarmshare.example,Upland Farm Share,Director,United States,108,18,Within 1 month,Web form,Please send pricing.
L-2432,2026-11-27 09:05,Sabine Kowalcyzk,SABINE.kowalczyk@Dovecotemealkits.example,Dovecote Meal Kits,Executive,USA,"1,200",220,Within 1 month,Webinar,
L-2433,2026-11-27 12:00,Petra Baptiste,petra.baptiste@verityhomecaresupply.example,Verity Home Care Supply,Manager,United States,660,220,Within 1 month,Trade show,
L-2434,2026-11-27 12:52,Wendell Kessler,wendell.kessler@wexcombebrewing.example,Wexcombe Brewing,Manager,United Kingdom,,6,1 to 3 months,Web form,Drivers keep missing delivery windows. Need a demo.
L-2435,2026-11-27 13:30,Greta Yilmaz,greta.yilmaz@lowfieldfeedseed.example,Lowfield Feed and Seed,Director,UK,240,45,1 to 3 months,Web form,"Sorry, forgot to say we run 45 trucks."
L-2436,2026-11-27 15:01,Yara Rahimi,yara.rahimi@yarrowfieldeggs.example,Yarrowfield Eggs,Owner,Canada,180,30,,Web form,Looking at options before our lease renewal.
L-2437,2026-11-27 17:06,Simeon Fairweather,simeon.fairweather@zennorfishmarket.example,Zennor Fish Market,Executive,U.S.,330,110,3 to 6 months,Web form,Fuel costs are up and we need tighter routes.
L-2438,2026-11-27 21:22,Elise Dunleavy,elise.dunleavy@ashdenefurniture.example,Ashdene Furniture,Director,United States,165,110,Within 1 month,Trade show,
L-2439,2026-11-28 08:26,Darius Sandoval,darius.sandoval@birchwickprint.example,Birchwick Print,Owner,Great Britain,320,110,Within 1 month,Referral,Drivers keep missing delivery windows. Need a demo.
L-2440,2026-11-28 10:06,Fern Cho,fern.cho@cranmoordentallab.example,Cranmoor Dental Lab,Consultant,Canada,150,75,1 to 3 months,Referral,
L-2441,2026-11-28 12:38,Malik Abernathy,malik.abernathy@drayfordmattress.example,Drayford Mattress,Director,Ireland,540,90,Just looking,Web form,Saw your talk and want to learn more.
L-2442,2026-11-28 13:20,Rosalind Volkov,rosalind.volkov@elmsteadglass.example,Elmstead Glass,Owner,United States,660,4,Within 1 month,Referral,We route by hand on a whiteboard and it no longer works.
L-2443,2026-11-28 16:02,Teo Trask,teo.trask@foxholloworganics.example,Foxhollow Organics,Director,Canada,18,12,Within 1 month,Webinar,Do you integrate with our order system?
L-2444,2026-11-28 17:28,Aurelia Mbeki,aurelia.mbeki@glenrothybutchers.example,Glenrothy Butchers,Manager,United States,40,18,1 to 3 months,Web form,Please send pricing.
L-2445,2026-11-28 19:26,Jonas Larkspur,jonas.larkspur@hartseasebread.example,Hartsease Bread,Consultant,U.S.,60,30,1 to 3 months,Web form,
input/qualification_criteria.md · 71 lines, 2 KB
# Lead qualification criteria

Brindle Route sales team. In force from 3 November 2026.

We sell route planning software to companies that run their own delivery vehicles. These rules decide
what happens to every lead that comes in. Apply the three gates in order. Only a lead that gets
through all three gates is scored.

## Reading the fields

- Email: ignore capital letters and any spaces before or after it.
- Country: USA, US and U.S. mean United States. UK and Great Britain mean United Kingdom.
- Employees: people type this in many ways. Ignore commas and a plus sign (1,200 is 1200 and 250+ is
  250). When a range is typed (50-100), use the lower number.
- Vehicles: a whole number.

## Gate 1. Duplicate

Two leads are the same person when the email is the same. Keep the earliest by submitted_at. Every
later one gets status `duplicate`, whatever else it says. Name the lead it repeats in the reason.

## Gate 2. Missing facts

If email, country, employees or vehicles is blank, the status is `needs_info`. Name the blank field
in the reason. Do not score it.

## Gate 3. Not a fit

The status is `disqualified` when any of these is true. Give the first one that applies as the reason.

1. The email is at a personal mail domain: gmail.com, yahoo.com, outlook.com, hotmail.com, icloud.com
   or proton.me.
2. The country is not one we serve. We serve United States, Canada, United Kingdom, Ireland and
   Australia.
3. The company runs fewer than 5 vehicles.
4. The role is Student.

## Score

Add the points from each row. The most a lead can score is 100.

| What | Value | Points |
|---|---|---|
| Vehicles | 5 to 19 | 10 |
| Vehicles | 20 to 99 | 25 |
| Vehicles | 100 or more | 35 |
| Role | Owner or Executive | 25 |
| Role | Director | 20 |
| Role | Manager | 12 |
| Role | Individual contributor or Consultant | 5 |
| Timeline | Within 1 month | 20 |
| Timeline | 1 to 3 months | 15 |
| Timeline | 3 to 6 months | 8 |
| Timeline | Just looking, or blank | 0 |
| Employees | under 50 | 5 |
| Employees | 50 to 499 | 10 |
| Employees | 500 or more | 15 |
| Source | Referral | 5 |
| Source | anything else | 0 |

## Status from the score

- 70 or more: `qualified`. A seller calls within one working day.
- 45 to 69: `nurture`. Goes to the monthly mailing.
- under 45: `low_priority`. No action.

## Who gets a qualified lead

- United States and Canada: Americas desk
- United Kingdom and Ireland: Europe desk
- Australia: Pacific desk
output/handoff.md · written by the agent, 30 lines
- qualified: 10
- nurture: 18
- low_priority: 4
- needs_info: 3
- disqualified: 7
- duplicate: 3

Total leads: 45

## Qualified (highest score first)
- L-2415, Dovecote Meal Kits, 100, Americas desk
- L-2439, Birchwick Print, 95, Europe desk
- L-2402, Pinebrook Beverage, 85, Americas desk
- L-2438, Ashdene Furniture, 85, Americas desk
- L-2433, Verity Home Care Supply, 82, Americas desk
- L-2405, Ostrander Building Supply, 80, Pacific desk
- L-2437, Zennor Fish Market, 78, Americas desk
- L-2411, Larchmont Pharmacy Supply, 70, Americas desk
- L-2423, Northcliff Paper, 70, Europe desk
- L-2430, Thistledown Laundry, 70, Americas desk

## Needs more facts
- L-2421, Lowfield Feed and Seed: vehicles is blank
- L-2426, Quarry Hill Fuel: country is blank
- L-2434, Wexcombe Brewing: employees is blank

## Notes
- L-2435 is marked duplicate of L-2421 because the criteria keep the earliest lead for an email. L-2421 itself needs vehicles, and L-2435 carries a vehicle count (45, per its message). The criteria do not let a duplicate fill in a field, so a seller may want to merge the two by hand.
- L-2432 is a duplicate of L-2415 (same email once capitals are ignored, though the name is spelled differently).
- L-2428 is a duplicate of L-2402.
output/lead_decisions.csv · written by the agent, 46 lines
lead_id,status,score,route_to,reason
L-2401,nurture,60,,Score 60 = vehicles 30 (25) + role Director (20) + timeline Just looking (0) + employees 180 (10) + source Referral (5).
L-2402,qualified,85,Americas desk,Score 85 = vehicles 75 (25) + role Owner (25) + timeline Within 1 month (20) + employees 160 (10) + source Referral (5).
L-2403,low_priority,40,,Score 40 = vehicles 6 (10) + role Director (20) + timeline Just looking (0) + employees 24 (5) + source Referral (5).
L-2404,disqualified,,,Gate 3: email is at personal mail domain gmail.com.
L-2405,qualified,80,Pacific desk,Score 80 = vehicles 75 (25) + role Owner (25) + timeline Within 1 month (20) + employees 150 (10) + source Web form (0).
L-2406,nurture,60,,Score 60 = vehicles 12 (10) + role Owner (25) + timeline 1 to 3 months (15) + employees 24 (5) + source Referral (5).
L-2407,disqualified,,,Gate 3: country Germany is not one we serve.
L-2408,nurture,52,,Score 52 = vehicles 75 (25) + role Manager (12) + timeline Just looking (0) + employees 150 (10) + source Referral (5).
L-2409,nurture,62,,Score 62 = vehicles 90 (25) + role Manager (12) + timeline 1 to 3 months (15) + employees 270 (10) + source Web form (0).
L-2410,disqualified,,,Gate 3: email is at personal mail domain outlook.com.
L-2411,qualified,70,Americas desk,Score 70 = vehicles 140 (35) + role Manager (12) + timeline 3 to 6 months (8) + employees 210 (10) + source Referral (5).
L-2412,nurture,62,,Score 62 = vehicles 22 (25) + role Manager (12) + timeline 1 to 3 months (15) + employees 88 (10) + source Webinar (0).
L-2413,disqualified,,,Gate 3: role is Student.
L-2414,nurture,50,,Score 50 = vehicles 6 (10) + role Director (20) + timeline 1 to 3 months (15) + employees 9 (5) + source Web form (0).
L-2415,qualified,100,Americas desk,Score 100 = vehicles 220 (35) + role Executive (25) + timeline Within 1 month (20) + employees 1200 (15) + source Referral (5).
L-2416,nurture,55,,Score 55 = vehicles 22 (25) + role Consultant (5) + timeline Within 1 month (20) + employees 33 (5) + source Webinar (0).
L-2417,low_priority,35,,Score 35 = vehicles 15 (10) + role Director (20) + timeline Just looking (0) + employees 30 (5) + source Web form (0).
L-2418,disqualified,,,Gate 3: country New Zealand is not one we serve.
L-2419,nurture,65,,Score 65 = vehicles 18 (10) + role Executive (25) + timeline Within 1 month (20) + employees 54 (10) + source Web form (0).
L-2420,nurture,45,,Score 45 = vehicles 75 (25) + role Individual contributor (5) + timeline Just looking (0) + employees 150 (10) + source Referral (5).
L-2421,needs_info,,,Gate 2: vehicles is blank.
L-2422,low_priority,42,,Score 42 = vehicles 15 (10) + role Manager (12) + timeline 1 to 3 months (15) + employees 30 (5) + source Web form (0).
L-2423,qualified,70,Europe desk,Score 70 = vehicles 90 (25) + role Director (20) + timeline 1 to 3 months (15) + employees 250 (10) + source Web form (0).
L-2424,disqualified,,,"Gate 3: runs 3 vehicles, fewer than 5."
L-2425,nurture,48,,Score 48 = vehicles 90 (25) + role Consultant (5) + timeline 3 to 6 months (8) + employees 360 (10) + source Webinar (0).
L-2426,needs_info,,,Gate 2: country is blank.
L-2427,nurture,47,,Score 47 = vehicles 60 (25) + role Manager (12) + timeline blank (0) + employees 90 (10) + source Web form (0).
L-2428,duplicate,,,Gate 1: same email as earlier lead L-2402.
L-2429,nurture,52,,Score 52 = vehicles 15 (10) + role Manager (12) + timeline Within 1 month (20) + employees 60 (10) + source Web form (0).
L-2430,qualified,70,Americas desk,Score 70 = vehicles 30 (25) + role Director (20) + timeline 1 to 3 months (15) + employees 50 (10) + source Web form (0).
L-2431,nurture,60,,Score 60 = vehicles 18 (10) + role Director (20) + timeline Within 1 month (20) + employees 108 (10) + source Web form (0).
L-2432,duplicate,,,Gate 1: same email as earlier lead L-2415.
L-2433,qualified,82,Americas desk,Score 82 = vehicles 220 (35) + role Manager (12) + timeline Within 1 month (20) + employees 660 (15) + source Trade show (0).
L-2434,needs_info,,,Gate 2: employees is blank.
L-2435,duplicate,,,Gate 1: same email as earlier lead L-2421.
L-2436,nurture,60,,Score 60 = vehicles 30 (25) + role Owner (25) + timeline blank (0) + employees 180 (10) + source Web form (0).
L-2437,qualified,78,Americas desk,Score 78 = vehicles 110 (35) + role Executive (25) + timeline 3 to 6 months (8) + employees 330 (10) + source Web form (0).
L-2438,qualified,85,Americas desk,Score 85 = vehicles 110 (35) + role Director (20) + timeline Within 1 month (20) + employees 165 (10) + source Trade show (0).
L-2439,qualified,95,Europe desk,Score 95 = vehicles 110 (35) + role Owner (25) + timeline Within 1 month (20) + employees 320 (10) + source Referral (5).
L-2440,nurture,60,,Score 60 = vehicles 75 (25) + role Consultant (5) + timeline 1 to 3 months (15) + employees 150 (10) + source Referral (5).
L-2441,nurture,60,,Score 60 = vehicles 90 (25) + role Director (20) + timeline Just looking (0) + employees 540 (15) + source Web form (0).
L-2442,disqualified,,,"Gate 3: runs 4 vehicles, fewer than 5."
L-2443,nurture,55,,Score 55 = vehicles 12 (10) + role Director (20) + timeline Within 1 month (20) + employees 18 (5) + source Webinar (0).
L-2444,low_priority,42,,Score 42 = vehicles 18 (10) + role Manager (12) + timeline 1 to 3 months (15) + employees 40 (5) + source Web form (0).
L-2445,nurture,55,,Score 55 = vehicles 30 (25) + role Consultant (5) + timeline 1 to 3 months (15) + employees 60 (10) + source Web form (0).
check.py · the check, written before the run
"""Recomputes every lead's status, score and desk from the criteria and compares them with what the agent wrote."""
import csv, re, sys
from pathlib import Path
root = Path(sys.argv[1]); ok = True
def say(passed, text):
    global ok; ok = ok and passed; print(("PASS " if passed else "FAIL ") + text)
PERSONAL = {"gmail.com", "yahoo.com", "outlook.com", "hotmail.com", "icloud.com", "proton.me"}
ALIAS = {"usa": "United States", "us": "United States", "u.s.": "United States", "uk": "United Kingdom", "great britain": "United Kingdom"}
DESK = {"United States": "Americas desk", "Canada": "Americas desk", "United Kingdom": "Europe desk", "Ireland": "Europe desk", "Australia": "Pacific desk"}
def number(text):
    m = re.match(r"\d+", text.replace(",", "").strip())
    return int(m.group(0)) if m else None
leads = list(csv.DictReader((root/"input/leads.csv").open()))
want, seen, parts, facts = {}, set(), {}, {}
def figures(text):
    text = re.sub(r"\b[A-Za-z]+-\d+\b|\d{4}-\d{2}-\d{2}|\b\d{1,2}:\d\d\b", " ", text)
    return [float(x.replace(",", "")) for x in re.findall(r"(?<![\w.])\d[\d,]*(?:\.\d+)?", text)]
rules = set(figures((root/"input/qualification_criteria.md").read_text()))
for r in leads: facts[r["lead_id"]] = set(figures(" ".join(r.values())))
for r in sorted(leads, key=lambda r: (r["submitted_at"], r["lead_id"])):
    email = r["email"].strip().lower()
    country = ALIAS.get(r["country"].strip().lower(), r["country"].strip())
    emp, veh = number(r["employees"]), number(r["vehicles"])
    if email and email in seen:
        want[r["lead_id"]] = ("duplicate", None, ""); continue
    if email: seen.add(email)
    if not email or not country or emp is None or veh is None:
        want[r["lead_id"]] = ("needs_info", None, ""); continue
    if email.split("@")[-1] in PERSONAL or country not in DESK or veh < 5 or r["role"].strip() == "Student":
        want[r["lead_id"]] = ("disqualified", None, ""); continue
    each = [10 if veh < 20 else 25 if veh < 100 else 35,
            {"Owner": 25, "Executive": 25, "Director": 20, "Manager": 12}.get(r["role"].strip(), 5),
            {"Within 1 month": 20, "1 to 3 months": 15, "3 to 6 months": 8}.get(r["timeline"].strip(), 0),
            5 if emp < 50 else 10 if emp < 500 else 15, 5 if r["source"].strip() == "Referral" else 0]
    pts = sum(each); parts[r["lead_id"]] = set(each) | {pts, emp, veh, 45, 69, 70}
    st = "qualified" if pts >= 70 else "nurture" if pts >= 45 else "low_priority"
    want[r["lead_id"]] = (st, pts, DESK[country] if st == "qualified" else "")
path = root/"output/lead_decisions.csv"
if not path.exists():
    say(False, "output/lead_decisions.csv was not written"); sys.exit(1)
rows = list(csv.DictReader(path.open()))
got = {r.get("lead_id", ""): r for r in rows}
n = len(want)
say(set(got) == set(want) and len(rows) == n, f"{len(set(got) & set(want))} of {n} leads appear once in lead_decisions.csv")
right = sum(1 for k, w in want.items() if (got.get(k, {}).get("status") or "").strip() == w[0])
say(right == n, f"{right} of {n} statuses equal the status recomputed from the criteria")
scored = {k: w for k, w in want.items() if w[1] is not None}
def score_ok(k, w):
    s = (got.get(k, {}).get("score") or "").strip()
    return s == "" if w[1] is None else (s.isdigit() and int(s) == w[1])
sc = sum(1 for k, w in scored.items() if score_ok(k, w))
blank = sum(1 for k, w in want.items() if w[1] is None and score_ok(k, w))
say(sc == len(scored) and blank == n - len(scored), f"{sc} of {len(scored)} scores equal the points added up again from the table and {blank} of {n - len(scored)} unscored leads have no score")
qual = [k for k, w in want.items() if w[0] == "qualified"]
desk = sum(1 for k, w in want.items() if (got.get(k, {}).get("route_to") or "").strip() == w[2])
say(desk == n, f"{sum(1 for k in qual if (got.get(k, {}).get('route_to') or '').strip() == want[k][2])} of {len(qual)} qualified leads go to the right desk and no other lead is sent to one")
hand = (root/"output/handoff.md").read_text() if (root/"output/handoff.md").exists() else ""
counts = {}
for st, _, _ in want.values(): counts[st] = counts.get(st, 0) + 1
stated = sum(1 for st, c in counts.items() if re.search(r"^\W*" + st + r"\W*:\W*" + str(c) + r"\b", hand, re.M))
say(stated == len(counts), f"handoff.md gives the right count for {stated} of {len(counts)} statuses")
pos = sorted((hand.find(k), k) for k in qual)
in_order = all(p >= 0 for p, _ in pos) and all(want[a][1] >= want[b][1] for (_, a), (_, b) in zip(pos, pos[1:]))
first = {k: next((ln for ln in hand.splitlines() if k in ln), "") for k in qual}
shown = sum(1 for k in qual if figures(first[k]) == [want[k][1]] and want[k][2] in first[k])
say(in_order and shown == len(qual), f"handoff.md lists {shown} of {len(qual)} qualified leads with the right score and desk, highest score first")
info = [k for k, w in want.items() if w[0] == "needs_info"]
say(all(k in hand for k in info), f"handoff.md names {sum(1 for k in info if k in hand)} of {len(info)} leads that need more facts")
ids = re.compile(r"\b[A-Za-z]+-\d+\b")
claims = good = 0
for ln in hand.splitlines():
    allowed = set(counts.values()) | {n}
    for k in ids.findall(ln): allowed |= facts.get(k, set()) | ({want[k][1]} if k in want and want[k][1] is not None else set())
    for x in figures(ln): claims += 1; good += x in allowed
say(claims > 0 and good == claims, f"{good} of {claims} numbers in handoff.md are a status count, the number of leads or a figure from the row of a lead named on that line")
claims = good = 0
for k, w in want.items():
    allowed = (facts[k] | parts[k]) if w[1] is not None else (facts[k] | rules)
    for x in figures(got.get(k, {}).get("reason") or ""): claims += 1; good += x in allowed
say(claims > 0 and good == claims, f"{good} of {claims} numbers in the reasons come from the lead's own row, its own points or the criteria")
sys.exit(0 if ok else 1)

leads.csv: sample data written by Atris. Fingerprint 64965d7ed3c5.

qualification_criteria.md: sample data written by Atris. Fingerprint 7d39244d86ee.

handoff.md: written by the agent. Fingerprint 25e90332c64e.

lead_decisions.csv: written by the agent. Fingerprint ff6d99831f77.


More sales work, and every other desk job

For agentsGitHub
What is AtrisBlogApp StorePricingPrivacyTerms