Atris

Rank customers by renewal risk.
Done by an agent. Checked twice.

Every customer gets a renewal risk score you can work out again from usage and support records, ranked riskiest first.

Have Atris do this for you›

1

Real files in

  • accounts.csv
    Forty customer accounts with plan, seats, yearly revenue and renewal date, one with seats missing. 41 lines, 3 KB.
  • risk_rules.md
    A customer success team's rules for scoring renewal risk: six tests, special cases, tiers and how to rank. 47 lines, 3 KB.
  • support_tickets.csv
    Eighty-seven support tickets with severity, status and satisfaction score, including a ticket exported twice, names typed wrong and tickets that match no account. 88 lines, 4 KB.
  • usage_monthly.csv
    Six months of active seat counts per account, with missing months, a month exported twice and rows for an account that does not exist. 233 lines, 4 KB.

Sample data written by Atris. Not a real company.

2

Three steps

  1. 1.Read the rules and clean the records
  2. 2.Score and rank every account
  3. 3.Write the renewal summary

Claude Sonnet 5.5, 1 min 16 s. No web. It never saw the check.

3

Checked twice

  • ✓Passed: 40 of 40 accounts appear once in renewal_risk.csv with the name, yearly revenue and renewal date from the accounts file
  • ✓Passed: 40 of 40 scores equal the points added up again from the usage and support records
  • ✓Passed: 40 of 40 accounts have the right tier and exactly the reasons that gave them points
  • ✓Passed: 40 of 40 accounts hold the rank the rules give, highest score first with ties broken by revenue
  • ✓Passed: renewal_summary.md gives the right count and revenue for 3 of 3 tiers, with 13 accounts and 180,360.00 at high risk
  • ✓Passed: renewal_summary.md lists 10 of 10 highest ranked accounts in rank order, each with its own rank, score and yearly revenue
  • ✓Passed: renewal_summary.md names 2 of 2 tickets that match no account
  • ✓Passed: 149 of 149 numbers and dates in renewal_summary.md are a tier count or total worked out again, a figure from the rules or one worked out from the records of an account named on that line

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 13 of renewal_risk.csv, copied from the file.
rank,account_id,account,arr,renewal_date,score,tier,reasons
1,A-429,Wetwang Therapy,16800,2027-02-13,85,high,usage_drop;low_seat_use;open_sev1;renews_soon
2,A-422,Naburn Dental,5040,2027-02-26,80,high,usage_drop;low_seat_use;low_csat;renews_soon
3,A-412,Cawood Physio,30000,2027-06-18,65,high,usage_drop;open_sev1;low_csat
4,A-444,Pollington Physio,16800,2027-02-13,65,high,usage_drop;low_seat_use;renews_soon
5,A-442,Newbald Clinics,6000,2027-01-14,65,high,usage_drop;low_seat_use;renews_soon
6,A-419,Kexby Therapy,18000,2027-01-14,55,high,usage_drop;low_seat_use;renews_soon
7,A-426,Skipwith Vets,10500,2026-12-12,55,high,usage_drop;low_seat_use;low_csat;renews_soon
8,A-416,Gilberdyke Dental,25200,2027-03-05,50,high,usage_drop;low_seat_use
9,A-427,Thorganby Care Homes,25200,2027-03-30,50,high,usage_drop;open_sev1;low_csat
10,A-447,Tibthorpe Dental,18000,2027-03-05,50,high,usage_drop;low_seat_use
11,A-431,Acaster Hearing,4500,2027-06-18,50,high,usage_drop;low_seat_use
12,A-435,Escrick Dental,2160,2027-01-14,50,high,usage_drop;low_seat_use;renews_soon

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 1 of 1 on 1 December 2026. The agent took 1 min 16 s.

What the second review verified

  • Rescored all 40 accounts by hand from the three exports and the rules. Every score, tier, reason list and rank in renewal_risk.csv matches, including the tie order among the six accounts on 50 (A-416 and A-427 at 25,200 arr, then A-447, A-431, A-435, A-437).
  • Values exactly on a limit land on the right side: Cawood A-412 usage fell from 100 to 70 seats, exactly 30%, and scores 30, while its 70/100 seat use scores 0. Birkdale A-411 at 10/20 seats (exactly 50%) scores 10. Dalby A-413 fell from 50 to 45 seats, exactly 10%, and scores 15. Pocklington A-424's csat of 3 and 3 averages exactly 3.0 and scores nothing.
  • The cleaning follows the rules. The later A-422 2026-11 row (3 seats) is used, which gives Naburn 3/12 seats in use and an 80 score. The later T-7082 row (closed, csat 4) is used, so Ulleskelf gets no open_sev1. T-7083 'wetwang therapy' is matched to A-429 by name. 'Open' and 'OPEN' statuses are counted as open. A-999 is ignored.
  • The tier totals were added up again: high is 13 accounts and 180,360; medium is 11 and 223,680; low is 16 and 215,940. The orphans are exactly T-7084 (blank id, 'Yapham Clinic Group') and T-7085 (A-388 not in accounts.csv).

What this run does not show

  • The accounts, usage and tickets were written by Atris. The scoring rules are one invented team's rules, not a proven way to tell who will leave.
  • The first check did not test the name, revenue and renewal date columns or the figures in the summary. The stricter check does and the same output passed.
  • The reasons written beside each account are tested for their numbers only. A number changed to another true figure for the same account would pass. So would a changed rank in a sentence that names no account.

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
# Rank customers by renewal risk

function: sales
for: the account manager who decides which renewals to work first
goal: Every customer has a risk score built from its own usage and support records, ranked so the riskiest renewals are worked first.

## 1. Read the rules and clean the records
Read input/risk_rules.md first. Then read input/accounts.csv, input/usage_monthly.csv and
input/support_tickets.csv. The rules file gives the as-of date, how to handle rows that appear twice,
how to match tickets to accounts and what to do with records that match no account. Clean the three
files that way before scoring anything. Use python3 for all of it.

## 2. Score and rank every account
Put every account in accounts.csv through every test in the rules, including the special cases. Add
up the points, give the tier and rank the accounts the way the rules say. Work with exact fractions,
not floating point, so that a value exactly on a limit lands on the side the rules say.

Write output/renewal_risk.csv with columns rank,account_id,account,arr,renewal_date,score,tier,reasons.
One row per account, in rank order starting at 1. reasons holds the reason words for the tests that
gave points, joined by a semicolon in the order the rules list them, blank when the score is 0.

## 3. Write the renewal summary
Write output/renewal_summary.md for the account managers:
- one line per tier in the form `- high: 6 accounts, 123,400.00`, giving the count and the total arr
- the ten highest ranked accounts, one line each, with rank, account, score, arr, renewal date and
  what the reason words mean in plain words for that account
- every orphan ticket by ticket_id, with what is wrong with it
- any other problem in the exports that someone should fix at the source.

## Done looks like
- Every account appears once in renewal_risk.csv with a rank from 1 to the number of accounts.
- Every score can be worked out again from the three exports and the rules.
- The tier counts and totals in the summary equal those in renewal_risk.csv.
input/accounts.csv · 41 lines, 3 KB
account_id,account,plan,seats_purchased,arr,renewal_date,owner
A-410,Ashcombe Dental,Starter,60,10800,2027-03-30,Bryony Castell
A-411,Birkdale Vets,Starter,20,3600,2027-02-13,Imran Sethi
A-412,Cawood Physio,Team,100,30000,2027-06-18,Lowri Penhale
A-413,Dalby Opticians,Team,60,18000,2027-08-17,Bryony Castell
A-414,Elloughton Clinics,Group,40,16800,2027-05-09,Imran Sethi
A-415,Fangfoss Care,Team,20,6000,2027-03-30,Lowri Penhale
A-416,Gilberdyke Dental,Group,60,25200,2027-03-05,Bryony Castell
A-417,Hessle Hearing,Group,12,5040,2027-06-18,Imran Sethi
A-418,Irton Medical,Starter,25,16200,2026-12-30,Lowri Penhale
A-419,Kexby Therapy,Team,60,18000,2027-01-14,Bryony Castell
A-420,Langtoft Vets,Team,,27000,2026-12-30,Imran Sethi
A-421,Melbourne Skin Clinic,Team,12,3600,2027-01-14,Lowri Penhale
A-422,Naburn Dental,Group,12,5040,2027-02-26,Bryony Castell
A-423,Osgodby Physio,Team,12,3600,2026-12-30,Imran Sethi
A-424,Pocklington Eye Care,Team,12,3600,2026-12-30,Lowri Penhale
A-425,Riccall Podiatry,Group,60,25200,2027-03-30,Bryony Castell
A-426,Skipwith Vets,Group,25,10500,2026-12-12,Imran Sethi
A-427,Thorganby Care Homes,Group,60,25200,2027-03-30,Lowri Penhale
A-428,Ulleskelf Dental,Group,90,37800,2027-03-05,Bryony Castell
A-429,Wetwang Therapy,Group,40,16800,2027-02-13,Imran Sethi
A-430,Yapham Clinics,Group,40,16800,2027-03-30,Lowri Penhale
A-431,Acaster Hearing,Starter,25,4500,2027-06-18,Bryony Castell
A-432,Bubwith Medical,Team,12,3600,2026-12-30,Imran Sethi
A-433,Cliffe Physio,Starter,25,4500,2027-10-26,Lowri Penhale
A-434,Dunnington Vets,Team,150,45000,2027-10-26,Bryony Castell
A-435,Escrick Dental,Starter,12,2160,2027-01-14,Imran Sethi
A-436,Fulford Eye Care,Starter,8,1440,2027-08-17,Lowri Penhale
A-437,Goodmanham Care,Starter,12,2160,2027-08-17,Bryony Castell
A-438,Huggate Podiatry,Starter,90,16200,2026-12-30,Imran Sethi
A-439,Kilnwick Dental,Team,20,6000,2027-03-05,Lowri Penhale
A-440,Lund Therapy,Starter,8,1440,2027-06-18,Bryony Castell
A-441,Millington Vets,Starter,150,27000,2026-12-30,Imran Sethi
A-442,Newbald Clinics,Team,20,6000,2027-01-14,Lowri Penhale
A-443,Octon Dental,Group,150,63000,2027-08-17,Bryony Castell
A-444,Pollington Physio,Group,40,16800,2027-02-13,Imran Sethi
A-445,Rillington Medical,Starter,40,7200,2027-03-30,Lowri Penhale
A-446,Sancton Vets,Group,20,8400,2027-03-30,Bryony Castell
A-447,Tibthorpe Dental,Team,60,18000,2027-03-05,Imran Sethi
A-448,Warter Care Homes,Team,150,45000,2027-06-18,Lowri Penhale
A-449,Youlthorpe Skin Clinic,Group,40,16800,2027-08-17,Bryony Castell
input/risk_rules.md · 47 lines, 3 KB
# Renewal risk rules

Marlpit Clinic Software, customer success team. These rules score every customer for the monthly
renewal review. All three exports in this folder were taken on 2026-11-30. That is the as-of date.

## Cleaning the exports

- Usage: one row per account per month, June to November 2026. If a month is there twice for one
  account, the lower row is a correction. Use it. Ignore usage rows for an account that is not in
  accounts.csv.
- Tickets: if a ticket_id is there twice, the lower row is the current state. Use it. Match a ticket
  to its account by account_id. The account_name on a ticket is typed by hand and is often wrong, so
  do not use it when there is an id. If account_id is blank, match on account_name when it is exactly
  an account's name, ignoring capital letters.
- A ticket that matches no account is an orphan. Leave it out of the scoring and list it in the
  summary by ticket_id.
- Status can be typed in any mix of capital and small letters.

## Points

Score every account on all six tests. A higher score is a bigger risk.

| Test | Points | Reason word |
|---|---|---|
| Usage fell. Take the average active seats for June to August and for September to November, using the months that are there. The drop is how far the later average is below the earlier one, as a share of the earlier one. | 30 if the drop is 30% or more. 15 if it is 10% or more but under 30%. | usage_drop |
| Seats sit unused. Take active seats in the latest month the account has and divide by seats_purchased. | 20 if under 50%. 10 if 50% or more but under 70%. | low_seat_use |
| Serious open ticket. Any ticket that is open with severity 1. | 20 | open_sev1 |
| Many open tickets. Only when there is no open severity 1 ticket: three or more open tickets. | 10 | open_tickets |
| Unhappy scores. Take tickets opened on or after 2026-09-01 that have a csat score. | 15 if their average is under 3.0. | low_csat |
| Renews soon. renewal_date is on or before 2027-02-28. | 15 | renews_soon |

Special cases:

- If the earlier three months have no usage rows, skip the usage fell test.
- If seats_purchased is blank or zero, skip the seats sit unused test.
- If an account has no usage rows at all, skip both usage tests and give 25 points with the reason
  word `no_usage_data`. Nobody is logging in or the feed is broken, and both need a call.
- A value exactly on a limit counts as reaching it. A drop of exactly 30% scores 30. Seat use of
  exactly 50% scores 10. An average of exactly 3.0 scores nothing.

## Tier and rank

- 50 points or more: `high`
- 25 to 49: `medium`
- under 25: `low`

Rank 1 is the highest score. Break ties by the larger arr, then by account_id.
input/support_tickets.csv · 88 lines, 4 KB
ticket_id,account_id,account_name,opened_date,severity,status,csat
T-7001,A-411,Birkdale Vets,2026-06-18,1,open,
T-7002,A-411,Birkdale Vets,2026-07-28,3,open,
T-7003,A-411,Birkdale Vets,2026-07-26,3,closed,5
T-7004,A-411,Birkdale Vets,2026-11-07,3,closed,
T-7005,A-412,Cawood Physio,2026-10-31,3,closed,1
T-7006,A-412,Cawood Physio,2026-11-13,3,open,
T-7007,A-412,Cawood Physio,2026-11-02,3,closed,4
T-7008,A-412,Cawood Physio,2026-09-30,3,closed,5
T-7009,A-414,Elloughton Clinics,2026-07-04,3,open,
T-7010,A-416,Gilberdyke Dental,2026-09-11,2,closed,4
T-7011,A-417,Hessle Hearing,2026-09-28,1,closed,4
T-7012,A-417,Hessle Hearing,2026-10-04,2,closed,5
T-7013,A-417,Hessle Hearing,2026-09-25,3,closed,5
T-7014,A-418,Irton Medical,2026-10-19,2,closed,
T-7015,A-419,Kexby Therapy,2026-10-25,3,open,
T-7016,A-420,Langtoft Vets,2026-11-05,1,closed,1
T-7017,A-420,Langtoft Vets,2026-07-19,3,closed,2
T-7018,A-421,Melbourne Skin Clinic,2026-11-25,2,closed,5
T-7019,A-422,Naburn Dental,2026-11-29,3,open,
T-7020,A-422,Naburn Dental,2026-10-07,1,closed,2
T-7021,A-422,Naburn Dental,2026-10-15,2,open,
T-7022,A-423,Osgodby Physio,2026-07-31,2,open,
T-7023,A-423,Osgodby Physio,2026-10-29,1,open,
T-7024,A-423,Osgodby Physio,2026-06-17,2,open,
T-7025,A-423,Osgodby Physio,2026-07-21,3,closed,5
T-7026,A-423,Osgodby Physio,2026-07-08,3,closed,5
T-7027,A-423,Osgodby Physio,2026-10-03,1,closed,
T-7028,A-425,Riccall Podiatry,2026-07-24,2,closed,5
T-7029,A-428,Ulleskelf Dental,2026-06-22,2,closed,1
T-7030,A-428,Ulleskelf Dental,2026-10-10,3,closed,5
T-7031,A-429,Wetwang Therapy,2026-07-18,3,closed,4
T-7032,A-429,Wetwang Therapy,2026-08-12,2,open,
T-7033,A-429,Wetwang Therapy,2026-07-17,3,closed,4
T-7034,A-429,Wetwang Therapy,2026-10-19,1,open,
T-7035,A-430,Yapham Clinics,2026-09-16,2,closed,4
T-7036,A-430,Yapham Clinics,2026-06-21,3,closed,4
T-7037,A-431,Acaster Hearing,2026-10-01,3,closed,4
T-7038,A-432,Bubwith Medical,2026-07-07,3,closed,2
T-7039,A-434,Dunnington Vets,2026-06-27,2,closed,4
T-7040,A-436,Fulford Eye Care,2026-09-15,3,closed,4
T-7041,A-437,Goodmanham Care,2026-10-20,2,open,
T-7042,A-440,Lund Therapy,2026-07-09,3,closed,4
T-7043,A-441,Millington Vets,2026-10-27,2,closed,3
T-7044,A-443,Octon Dental,2026-08-10,3,closed,5
T-7045,A-443,Octon Dental,2026-08-28,3,closed,4
T-7046,A-443,Octon Dental,2026-09-22,3,open,
T-7047,A-443,Octon Dental,2026-10-28,2,open,
T-7048,A-444,Pollington Physio,2026-07-27,3,open,
T-7049,A-445,Rillington Medical,2026-07-23,2,closed,5
T-7050,A-445,Rillington Medical,2026-11-22,3,closed,
T-7051,A-445,Rillington Medical,2026-11-09,2,open,
T-7052,A-446,Sancton Vets,2026-07-24,1,closed,4
T-7053,A-446,Sancton Vets,2026-11-02,2,closed,5
T-7054,A-446,Sancton Vets,2026-10-17,3,closed,5
T-7055,A-447,Tibthorpe Dental,2026-06-22,3,closed,2
T-7056,A-447,Tibthorpe Dental,2026-06-13,3,closed,
T-7057,A-447,Tibthorpe Dental,2026-11-21,2,closed,5
T-7058,A-448,Warter Care Homes,2026-06-17,2,closed,5
T-7059,A-449,Youlthorpe Skin Clinic,2026-09-15,2,open,
T-7060,A-449,Youlthorpe Skin Clinic,2026-07-25,3,closed,5
T-7061,A-449,Youlthorpe Skin Clinic,2026-06-15,3,closed,2
T-7062,A-449,Youlthorpe Skin Clinic,2026-07-04,3,closed,4
T-7063,A-449,Youlthorpe Skin Clinic,2026-06-29,3,open,
T-7064,A-449,Youlthorpe Skin Clinic,2026-08-29,3,open,
T-7065,A-412,Cawood Physio,2026-11-21,1,open,
T-7066,A-412,Cawood Physio,2026-10-31,2,closed,2
T-7067,A-412,Cawood Physio,2026-10-17,3,closed,1
T-7068,A-427,Thorganby Care Homes,2026-11-25,1,Open,
T-7069,A-427,Thorganby Care Homes,2026-11-18,2,open,
T-7070,A-427,Thorganby Care Homes,2026-11-10,2,closed,2
T-7071,A-423,Osgodby Physio,2026-11-15,2,open,
T-7072,A-423,Osgodby Physio,2026-11-09,3,open,
T-7073,A-423,Osgodby Physio,2026-10-28,3,OPEN,
T-7074,A-424,Pocklington Eye Care,2026-10-21,3,closed,3
T-7075,A-424,Pocklington Eye Care,2026-10-11,3,closed,3
T-7076,A-425,Riccall Podiatry,2026-08-22,2,closed,1
T-7077,A-425,Riccall Podiatry,2026-08-12,2,closed,1
T-7078,A-425,Riccall Podiatry,2026-11-10,3,closed,5
T-7079,A-426,Skipwith Vets,2026-11-05,2,closed,2
T-7080,A-426,Skipwith Vets,2026-10-26,2,closed,3
T-7081,A-426,Skipwith Vets,2026-10-01,3,closed,3
T-7082,A-428,Ulleskelf Dental,2026-11-16,1,open,
T-7083,,wetwang therapy,2026-11-12,2,open,
T-7084,,Yapham Clinic Group,2026-11-08,1,open,
T-7085,A-388,Acaster Hearing Ltd,2026-11-03,1,open,
T-7086,A-432,Bubwith Med,2026-11-22,2,closed,1
T-7082,A-428,Ulleskelf Dental,2026-11-16,1,closed,4
input/usage_monthly.csv · 233 lines, 4 KB
account_id,month,active_seats
A-410,2026-06,54
A-410,2026-07,53
A-410,2026-08,52
A-410,2026-09,51
A-410,2026-10,50
A-410,2026-11,49
A-411,2026-06,11
A-411,2026-07,11
A-411,2026-08,11
A-411,2026-09,10
A-411,2026-10,10
A-411,2026-11,10
A-412,2026-06,100
A-412,2026-07,100
A-412,2026-08,100
A-412,2026-09,70
A-412,2026-10,70
A-412,2026-11,70
A-413,2026-06,50
A-413,2026-07,50
A-413,2026-08,50
A-413,2026-09,45
A-413,2026-10,45
A-413,2026-11,45
A-414,2026-06,36
A-414,2026-07,35
A-414,2026-08,37
A-414,2026-09,30
A-414,2026-10,24
A-414,2026-11,20
A-415,2026-06,15
A-415,2026-07,15
A-415,2026-08,14
A-415,2026-09,14
A-415,2026-10,14
A-415,2026-11,14
A-416,2026-06,36
A-416,2026-07,29
A-416,2026-08,23
A-416,2026-09,18
A-416,2026-10,15
A-416,2026-11,12
A-418,2026-09,9
A-418,2026-10,14
A-418,2026-11,18
A-419,2026-06,60
A-419,2026-07,60
A-419,2026-09,36
A-419,2026-10,36
A-419,2026-11,36
A-420,2026-06,68
A-420,2026-07,68
A-420,2026-08,68
A-420,2026-09,68
A-420,2026-10,68
A-420,2026-11,68
A-421,2026-06,12
A-421,2026-07,13
A-421,2026-08,14
A-421,2026-09,14
A-421,2026-10,15
A-421,2026-11,15
A-422,2026-06,10
A-422,2026-07,9
A-422,2026-08,9
A-422,2026-09,8
A-422,2026-10,7
A-422,2026-11,7
A-423,2026-06,11
A-423,2026-07,11
A-423,2026-08,10
A-423,2026-09,10
A-423,2026-10,10
A-423,2026-11,10
A-424,2026-06,11
A-424,2026-07,11
A-424,2026-08,11
A-424,2026-09,11
A-424,2026-10,11
A-424,2026-11,11
A-425,2026-06,45
A-425,2026-07,45
A-425,2026-08,45
A-425,2026-09,45
A-425,2026-10,45
A-425,2026-11,45
A-426,2026-06,21
A-426,2026-07,20
A-426,2026-08,19
A-426,2026-09,18
A-426,2026-10,17
A-426,2026-11,16
A-427,2026-06,54
A-427,2026-07,51
A-427,2026-08,49
A-427,2026-09,46
A-427,2026-10,44
A-427,2026-11,42
A-428,2026-06,50
A-428,2026-07,46
A-428,2026-08,42
A-428,2026-09,39
A-428,2026-10,35
A-428,2026-11,33
A-429,2026-06,34
A-429,2026-07,29
A-429,2026-08,25
A-429,2026-09,21
A-429,2026-10,18
A-429,2026-11,15
A-430,2026-06,22
A-430,2026-07,22
A-430,2026-08,22
A-430,2026-09,22
A-430,2026-10,22
A-430,2026-11,22
A-431,2026-06,15
A-431,2026-07,12
A-431,2026-08,10
A-431,2026-09,8
A-431,2026-10,6
A-431,2026-11,5
A-432,2026-06,10
A-432,2026-07,10
A-432,2026-08,10
A-432,2026-09,10
A-432,2026-10,10
A-432,2026-11,10
A-433,2026-06,21
A-433,2026-07,21
A-433,2026-08,21
A-433,2026-09,21
A-433,2026-10,21
A-433,2026-11,21
A-434,2026-06,128
A-434,2026-07,128
A-434,2026-08,128
A-434,2026-09,128
A-434,2026-10,128
A-434,2026-11,128
A-435,2026-06,7
A-435,2026-07,7
A-435,2026-08,6
A-435,2026-09,6
A-435,2026-10,5
A-435,2026-11,5
A-436,2026-06,4
A-436,2026-07,4
A-436,2026-08,4
A-436,2026-09,3
A-436,2026-10,3
A-436,2026-11,3
A-437,2026-06,10
A-437,2026-07,9
A-437,2026-08,7
A-437,2026-09,6
A-437,2026-10,5
A-437,2026-11,5
A-438,2026-06,86
A-438,2026-07,84
A-438,2026-08,82
A-438,2026-09,80
A-438,2026-10,79
A-438,2026-11,77
A-439,2026-06,12
A-439,2026-07,12
A-439,2026-08,12
A-439,2026-09,11
A-439,2026-10,11
A-439,2026-11,11
A-440,2026-06,4
A-440,2026-07,4
A-440,2026-08,5
A-440,2026-09,5
A-440,2026-10,5
A-440,2026-11,5
A-441,2026-06,112
A-441,2026-07,112
A-441,2026-08,112
A-441,2026-09,112
A-441,2026-10,112
A-441,2026-11,112
A-442,2026-06,18
A-442,2026-07,14
A-442,2026-08,12
A-442,2026-09,9
A-442,2026-10,7
A-442,2026-11,6
A-443,2026-06,90
A-443,2026-07,86
A-443,2026-08,81
A-443,2026-09,77
A-443,2026-10,73
A-443,2026-11,70
A-444,2026-06,30
A-444,2026-07,26
A-444,2026-08,22
A-444,2026-09,18
A-444,2026-10,16
A-444,2026-11,13
A-445,2026-06,38
A-445,2026-07,38
A-445,2026-08,38
A-445,2026-09,38
A-445,2026-10,38
A-445,2026-11,38
A-446,2026-06,15
A-446,2026-07,15
A-446,2026-08,15
A-446,2026-09,15
A-446,2026-10,15
A-446,2026-11,15
A-447,2026-06,33
A-447,2026-07,28
A-447,2026-08,24
A-447,2026-09,20
A-447,2026-10,17
A-447,2026-11,15
A-448,2026-06,135
A-448,2026-07,128
A-448,2026-08,122
A-448,2026-09,116
A-448,2026-10,110
A-448,2026-11,104
A-449,2026-06,24
A-449,2026-07,23
A-449,2026-08,22
A-449,2026-09,21
A-449,2026-10,20
A-449,2026-11,19
A-422,2026-11,3
A-999,2026-11,22
output/renewal_risk.csv · written by the agent, 41 lines
rank,account_id,account,arr,renewal_date,score,tier,reasons
1,A-429,Wetwang Therapy,16800,2027-02-13,85,high,usage_drop;low_seat_use;open_sev1;renews_soon
2,A-422,Naburn Dental,5040,2027-02-26,80,high,usage_drop;low_seat_use;low_csat;renews_soon
3,A-412,Cawood Physio,30000,2027-06-18,65,high,usage_drop;open_sev1;low_csat
4,A-444,Pollington Physio,16800,2027-02-13,65,high,usage_drop;low_seat_use;renews_soon
5,A-442,Newbald Clinics,6000,2027-01-14,65,high,usage_drop;low_seat_use;renews_soon
6,A-419,Kexby Therapy,18000,2027-01-14,55,high,usage_drop;low_seat_use;renews_soon
7,A-426,Skipwith Vets,10500,2026-12-12,55,high,usage_drop;low_seat_use;low_csat;renews_soon
8,A-416,Gilberdyke Dental,25200,2027-03-05,50,high,usage_drop;low_seat_use
9,A-427,Thorganby Care Homes,25200,2027-03-30,50,high,usage_drop;open_sev1;low_csat
10,A-447,Tibthorpe Dental,18000,2027-03-05,50,high,usage_drop;low_seat_use
11,A-431,Acaster Hearing,4500,2027-06-18,50,high,usage_drop;low_seat_use
12,A-435,Escrick Dental,2160,2027-01-14,50,high,usage_drop;low_seat_use;renews_soon
13,A-437,Goodmanham Care,2160,2027-08-17,50,high,usage_drop;low_seat_use
14,A-449,Youlthorpe Skin Clinic,16800,2027-08-17,45,medium,usage_drop;low_seat_use;open_tickets
15,A-411,Birkdale Vets,3600,2027-02-13,45,medium,low_seat_use;open_sev1;renews_soon
16,A-414,Elloughton Clinics,16800,2027-05-09,40,medium,usage_drop;low_seat_use
17,A-443,Octon Dental,63000,2027-08-17,35,medium,usage_drop;low_seat_use
18,A-428,Ulleskelf Dental,37800,2027-03-05,35,medium,usage_drop;low_seat_use
19,A-423,Osgodby Physio,3600,2026-12-30,35,medium,open_sev1;renews_soon
20,A-436,Fulford Eye Care,1440,2027-08-17,35,medium,usage_drop;low_seat_use
21,A-420,Langtoft Vets,27000,2026-12-30,30,medium,low_csat;renews_soon
22,A-432,Bubwith Medical,3600,2026-12-30,30,medium,low_csat;renews_soon
23,A-448,Warter Care Homes,45000,2027-06-18,25,medium,usage_drop;low_seat_use
24,A-417,Hessle Hearing,5040,2027-06-18,25,medium,no_usage_data
25,A-441,Millington Vets,27000,2026-12-30,15,low,renews_soon
26,A-413,Dalby Opticians,18000,2027-08-17,15,low,usage_drop
27,A-418,Irton Medical,16200,2026-12-30,15,low,renews_soon
28,A-438,Huggate Podiatry,16200,2026-12-30,15,low,renews_soon
29,A-421,Melbourne Skin Clinic,3600,2027-01-14,15,low,renews_soon
30,A-424,Pocklington Eye Care,3600,2026-12-30,15,low,renews_soon
31,A-430,Yapham Clinics,16800,2027-03-30,10,low,low_seat_use
32,A-439,Kilnwick Dental,6000,2027-03-05,10,low,low_seat_use
33,A-440,Lund Therapy,1440,2027-06-18,10,low,low_seat_use
34,A-434,Dunnington Vets,45000,2027-10-26,0,low,
35,A-425,Riccall Podiatry,25200,2027-03-30,0,low,
36,A-410,Ashcombe Dental,10800,2027-03-30,0,low,
37,A-446,Sancton Vets,8400,2027-03-30,0,low,
38,A-445,Rillington Medical,7200,2027-03-30,0,low,
39,A-415,Fangfoss Care,6000,2027-03-30,0,low,
40,A-433,Cliffe Physio,4500,2027-10-26,0,low,
output/renewal_summary.md · written by the agent, 46 lines
# Renewal risk summary

As-of date 2026-11-30 (all three exports). 40 accounts scored. Full list: renewal_risk.csv.

## Tiers

- high: 13 accounts, 180,360.00
- medium: 11 accounts, 223,680.00
- low: 16 accounts, 215,940.00

## Ten highest ranked accounts

1. Wetwang Therapy (A-429) - score 85, arr 16,800.00, renews 2027-02-13. Why: usage fell 38.6% (Jun-Aug average 29.3 seats to Sep-Nov 18.0); only 15 of 40 purchased seats active in 2026-11 (38%); has an open severity 1 ticket; renews on or before 2027-02-28.
2. Naburn Dental (A-422) - score 80, arr 5,040.00, renews 2027-02-26. Why: usage fell 35.7% (Jun-Aug average 9.3 seats to Sep-Nov 6.0); only 3 of 12 purchased seats active in 2026-11 (25%); average csat on tickets since 1 Sep is under 3.0; renews on or before 2027-02-28.
3. Cawood Physio (A-412) - score 65, arr 30,000.00, renews 2027-06-18. Why: usage fell 30.0% (Jun-Aug average 100.0 seats to Sep-Nov 70.0); has an open severity 1 ticket; average csat on tickets since 1 Sep is under 3.0.
4. Pollington Physio (A-444) - score 65, arr 16,800.00, renews 2027-02-13. Why: usage fell 39.7% (Jun-Aug average 26.0 seats to Sep-Nov 15.7); only 13 of 40 purchased seats active in 2026-11 (32%); renews on or before 2027-02-28.
5. Newbald Clinics (A-442) - score 65, arr 6,000.00, renews 2027-01-14. Why: usage fell 50.0% (Jun-Aug average 14.7 seats to Sep-Nov 7.3); only 6 of 20 purchased seats active in 2026-11 (30%); renews on or before 2027-02-28.
6. Kexby Therapy (A-419) - score 55, arr 18,000.00, renews 2027-01-14. Why: usage fell 40.0% (Jun-Aug average 60.0 seats to Sep-Nov 36.0); only 36 of 60 purchased seats active in 2026-11 (60%); renews on or before 2027-02-28.
7. Skipwith Vets (A-426) - score 55, arr 10,500.00, renews 2026-12-12. Why: usage fell 15.0% (Jun-Aug average 20.0 seats to Sep-Nov 17.0); only 16 of 25 purchased seats active in 2026-11 (64%); average csat on tickets since 1 Sep is under 3.0; renews on or before 2027-02-28.
8. Gilberdyke Dental (A-416) - score 50, arr 25,200.00, renews 2027-03-05. Why: usage fell 48.9% (Jun-Aug average 29.3 seats to Sep-Nov 15.0); only 12 of 60 purchased seats active in 2026-11 (20%).
9. Thorganby Care Homes (A-427) - score 50, arr 25,200.00, renews 2027-03-30. Why: usage fell 14.3% (Jun-Aug average 51.3 seats to Sep-Nov 44.0); has an open severity 1 ticket; average csat on tickets since 1 Sep is under 3.0.
10. Tibthorpe Dental (A-447) - score 50, arr 18,000.00, renews 2027-03-05. Why: usage fell 38.8% (Jun-Aug average 28.3 seats to Sep-Nov 17.3); only 15 of 60 purchased seats active in 2026-11 (25%).

Ranks 8 to 13 all score 50; ties are broken by larger arr, then account_id.

## Orphan tickets (left out of scoring)

- T-7084: account_id is blank and account_name 'Yapham Clinic Group' is not exactly any account's name (severity 1, status open).
- T-7085: account_id A-388 is not in accounts.csv (account_name 'Acaster Hearing Ltd', severity 1, status open). It was not matched by name because an id was given.

Both are open severity 1 tickets, so someone should find out which customer they belong to. T-7084 may be Yapham Clinics (A-430) and T-7085 may be Acaster Hearing (A-431), but the files do not say so and they were not guessed. If they do belong there, those accounts would each gain 20 points (open_sev1).

## Other problems to fix at the source

- Usage: A-422 2026-11 appears twice (7 then 3); used the lower row, 3.
- Usage: account_id A-999 is in usage_monthly.csv but not in accounts.csv; ignored (2026-11=22).
- Tickets: T-7082 appears twice (first row: status open, csat ''; second row: status closed, csat '4'); used the lower row.
- Tickets: T-7083 has no account_id; matched to A-429 Wetwang Therapy by account_name 'wetwang therapy' (capitalisation differs).
- Tickets: T-7068 status typed 'Open'; treated as open.
- Tickets: T-7073 status typed 'OPEN'; treated as open.
- Tickets: T-7086 account_name 'Bubwith Med' does not match A-432 (Bubwith Medical); matched by id.
- Usage: A-417 Hessle Hearing has no usage rows at all; scored 25 as no_usage_data.
- Usage: A-418 Irton Medical is missing month(s) 2026-06, 2026-07, 2026-08.
- Usage: A-419 Kexby Therapy is missing month(s) 2026-08.
- Accounts: A-420 Langtoft Vets has blank or zero seats_purchased; seat-use test skipped.
- Usage: A-421 Melbourne Skin Clinic active seats 15 in 2026-11 exceed seats_purchased 12.
check.py · the check, written before the run
"""Cleans the three exports again, scores and ranks every account from the written rules, then compares."""
import csv, re, sys
from fractions import Fraction
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)
def table(name): return list(csv.DictReader((root/"input"/name).open()))
accounts = {r["account_id"]: r for r in table("accounts.csv")}
by_name = {r["account"].strip().lower(): r["account_id"] for r in accounts.values()}
usage = {}
for r in table("usage_monthly.csv"):
    if r["account_id"] in accounts: usage.setdefault(r["account_id"], {})[r["month"]] = int(r["active_seats"])   # a lower row replaces an upper one
tickets = {}
for r in table("support_tickets.csv"): tickets[r["ticket_id"]] = r
mine, orphans = {}, []
for t in tickets.values():
    aid = t["account_id"].strip() or by_name.get(t["account_name"].strip().lower(), "")
    if aid in accounts: mine.setdefault(aid, []).append(t)
    else: orphans.append(t["ticket_id"])
want = {}
for aid, a in accounts.items():
    pts, why, calc = 0, [], []; u = usage.get(aid, {})
    if not u: pts += 25
    else:
        early = [u[m] for m in ("2026-06", "2026-07", "2026-08") if m in u]; late = [u[m] for m in ("2026-09", "2026-10", "2026-11") if m in u]
        if early and late:
            e, l = Fraction(sum(early), len(early)), Fraction(sum(late), len(late)); drop = (e - l) / e; calc += [e, l, drop * 100, e - l]
            if drop >= Fraction(30, 100): pts += 30; why.append("usage_drop")
            elif drop >= Fraction(10, 100): pts += 15; why.append("usage_drop")
        seats = int(a["seats_purchased"] or 0)
        if seats:
            use = Fraction(u[max(u)], seats); calc += [use * 100]
            if use < Fraction(1, 2): pts += 20; why.append("low_seat_use")
            elif use < Fraction(7, 10): pts += 10; why.append("low_seat_use")
    opened = [t for t in mine.get(aid, []) if t["status"].strip().lower() == "open"]
    if any(t["severity"].strip() == "1" for t in opened): pts += 20; why.append("open_sev1")
    elif len(opened) >= 3: pts += 10; why.append("open_tickets")
    rated = [int(t["csat"]) for t in mine.get(aid, []) if t["csat"].strip() and t["opened_date"] >= "2026-09-01"]
    if rated and Fraction(sum(rated), len(rated)) < 3: pts += 15; why.append("low_csat")
    calc += [len(opened), len(mine.get(aid, [])), len(rated), len(u), 6 - len(u)] + ([Fraction(sum(rated), len(rated))] if rated else [])
    if a["renewal_date"] <= "2027-02-28": pts += 15; why.append("renews_soon")
    if not u: why.append("no_usage_data")
    want[aid] = dict(score=pts, why=why, calc=[float(c) for c in calc], tier="high" if pts >= 50 else "medium" if pts >= 25 else "low", arr=float(a["arr"]))
order = sorted(want, key=lambda k: (-want[k]["score"], -want[k]["arr"], k))
path = root/"output/renewal_risk.csv"
if not path.exists():
    say(False, "output/renewal_risk.csv was not written"); sys.exit(1)
rows = list(csv.DictReader(path.open())); got = {(r.get("account_id") or "").strip(): r for r in rows}
def val(k, col): return (got.get(k, {}).get(col) or "").strip()
n = len(want)
def num0(text):
    try: return float(str(text).replace(",", "").replace("$", "").strip())
    except ValueError: return None
copied = sum(1 for k, w in want.items() if val(k, "account") == accounts[k]["account"].strip() and num0(val(k, "arr")) == w["arr"] and val(k, "renewal_date") == accounts[k]["renewal_date"].strip())
say(set(got) == set(want) and len(rows) == n and copied == n, f"{copied} of {n} accounts appear once in renewal_risk.csv with the name, yearly revenue and renewal date from the accounts file")
sc = sum(1 for k, w in want.items() if val(k, "score").isdigit() and int(val(k, "score")) == w["score"])
say(sc == n, f"{sc} of {n} scores equal the points added up again from the usage and support records")
ws = sum(1 for k, w in want.items() if val(k, "tier") == w["tier"] and sorted(x.strip() for x in val(k, "reasons").split(";") if x.strip()) == sorted(w["why"]))
say(ws == n, f"{ws} of {n} accounts have the right tier and exactly the reasons that gave them points")
rk = sum(1 for i, k in enumerate(order, 1) if val(k, "rank") == str(i))
say(rk == n and [(r.get("account_id") or "").strip() for r in rows] == order, f"{rk} of {n} accounts hold the rank the rules give, highest score first with ties broken by revenue")
text = (root/"output/renewal_summary.md").read_text() if (root/"output/renewal_summary.md").exists() else ""
def tier_line(tier):
    ws_ = [w for w in want.values() if w["tier"] == tier]
    for ln in text.splitlines():
        if re.search(r"\b" + tier + r"\b", ln.lower()):
            nums = [float(x.replace(",", "")) for x in re.findall(r"\d[\d,]*(?:\.\d+)?", ln)]
            if len(ws_) in nums and any(abs(x - sum(w["arr"] for w in ws_)) < 0.005 for x in nums): return True
    return False
tl = sum(1 for t in ("high", "medium", "low") if tier_line(t))
high = [w for w in want.values() if w["tier"] == "high"]
say(tl == 3, f"renewal_summary.md gives the right count and revenue for {tl} of 3 tiers, with {len(high)} accounts and {sum(w['arr'] for w in high):,.2f} at high risk")
DATE = r"\d{4}-\d\d(?:-\d\d)?"
def figures(t):
    t = re.sub(r"\b[A-Za-z]+-\d+\b|" + DATE, " ", t)
    return [float(x.rstrip(",").replace(",", "")) for x in re.findall(r"(?<![\w.])\d[\d,]*(?:\.\d+)?", t)]
top = [accounts[k]["account"] for k in order[:10]]; pos = [text.find(a) for a in top]
def own(k):
    found = figures(next((ln for ln in text.splitlines() if accounts[k]["account"] in ln), ""))
    return float(want[k]["score"]) in found and want[k]["arr"] in found and float(order.index(k) + 1) in found
owned = sum(1 for k in order[:10] if own(k))
say(all(p >= 0 for p in pos) and pos == sorted(pos) and owned == 10, f"renewal_summary.md lists {owned} of 10 highest ranked accounts in rank order, each with its own rank, score and yearly revenue")
say(all(t in text for t in orphans), f"renewal_summary.md names {sum(1 for t in orphans if t in text)} of {len(orphans)} tickets that match no account")
typed = {}
def note(aid, r): typed[aid] = typed.get(aid, "") + " " + " ".join(r.values())
for r in table("accounts.csv"): note(r["account_id"], r)
for r in table("usage_monthly.csv"): note(r["account_id"], r)
slips = {}
for r in table("support_tickets.csv"):
    slips[r["ticket_id"]] = slips.get(r["ticket_id"], "") + " " + " ".join(r.values())
    aid = r["account_id"].strip() or by_name.get(r["account_name"].strip().lower(), "")
    if aid: note(aid, r)
rules_text = (root/"input/risk_rules.md").read_text(); ruled = set(figures(rules_text)); months = {m for u in usage.values() for m in u}
base = ruled | {float(i) for i in range(n + 1)} | {float(w["score"]) for w in want.values()} | {float(len(orphans)), float(len(tickets)), float(len(slips))}
for t in ("high", "medium", "low"):
    ws_ = [w for w in want.values() if w["tier"] == t]; base |= {float(len(ws_)), sum(w["arr"] for w in ws_)}
def fits(x, aid):
    exact = set(figures(typed.get(aid, "")))
    if aid in want: exact |= {float(want[aid]["score"]), want[aid]["arr"], float(order.index(aid) + 1)}
    return x in exact or any(abs(x - c) <= 0.0501 or (x == int(x) and abs(x - c) <= 0.5) for c in want.get(aid, {}).get("calc", []))
claims = good = 0
for ln in text.splitlines():
    named = [a for a in set(re.findall(r"\bA-\d+\b", ln)) | {k for k, a in accounts.items() if a["account"] in ln}]
    seen = " ".join(slips.get(t, "") for t in re.findall(r"\bT-\d+\b", ln))
    for x in figures(ln):
        claims += 1
        good += (any(fits(x, a) for a in named) or x in figures(seen) or x in ruled) if (named or seen) else x in base
    for d in re.findall(DATE, ln): claims += 1; good += (d in months) if len(d) == 7 else (d in rules_text or d in seen or any(d in typed.get(a, "") for a in named) or (not named and d in " ".join(typed.values())))
say(claims > 0 and good == claims, f"{good} of {claims} numbers and dates in renewal_summary.md are a tier count or total worked out again, a figure from the rules or one worked out from the records of an account named on that line")
sys.exit(0 if ok else 1)

accounts.csv: sample data written by Atris. Fingerprint a8c02e54375e.

risk_rules.md: sample data written by Atris. Fingerprint 8dcfa1301a9b.

support_tickets.csv: sample data written by Atris. Fingerprint f21af0d3dc62.

usage_monthly.csv: sample data written by Atris. Fingerprint 41f0ba82f190.

renewal_risk.csv: written by the agent. Fingerprint e116bbabd16f.

renewal_summary.md: written by the agent. Fingerprint 0110f7b75de9.


More sales work, and every other desk job

For agentsGitHub
What is AtrisBlogApp StorePricingPrivacyTerms