Catch Split Expense Claims With Claude

- You need
- Expense lines as one CSV file
- Tested with
- Claude Sonnet 5.5, made-up data, 5 Nov 2026
- Result
- 120 of 120 lines matched the settled key
The rule we tested
Jonas Weber bought from Pine Street Stationers on 13 Oct in three lines: 10.00, 6.01 and 9.00. Each line is under the 25.00 receipt limit, so a check that looks at one line at a time lets all three through.
Together they total 25.01, and the key returns all three (EX-6018, EX-6040, EX-6115) under rule 3.
On 5 Nov 2026 we wrote four rules in plain English and Claude Sonnet 5.5 returned a script on its second turn.
Rule 3 returns every line of a split: two or more lines from the same employee, at the same merchant, on the same date, each 25.00 or less, none with a receipt, together over 25.00.
What you need
A CSV file
The checker needs expense lines with an employee, a merchant, a date, an amount and a receipt flag. We used a CSV file and connected nothing.
| Column | What the split rule uses it for |
|---|---|
employee_id, merchant, expense_date | Lines with the same three values form one group |
amount, receipt | Each line 25.00 or less, no receipt on any line, and a total over 25.00 |
category | Mileage lines need no receipt, which is why they raise a question |
description | The alcohol words in rule 1, which reject a line before rule 3 sees it |
Prompt 1: ask for a plan
Attach expense_lines.csv and paste this. We do not publish the data, so your numbers will differ from ours.
I look after expense claims in a finance team. I have one file, expense_lines.csv, with one row per expense line: claim_id, employee_id, employee, expense_date, merchant, category, description, amount, receipt (Y or N) and miles. Some people split one purchase into several small lines so that each line stays at or under the 25.00 receipt limit. I want a tool that catches that. My rules. A line gets the first rule it breaks. 1. Reject a line whose description mentions alcohol (wine, beer, cocktail, spirits or bar tab). 2. Return a line over 25.00 that has no receipt. Mileage lines do not need a receipt. 3. Return every line of a split. A split is two or more lines from the same employee, at the same merchant, on the same expense_date, where each line is 25.00 or less, none has a receipt, and together they come to more than 25.00. 4. Otherwise approve. Do not write code yet. Number the steps, say what could go wrong in each one, and list anything in my rules that is unclear.
Claude counted before it planned: 120 lines, 59 with no receipt, four Mileage lines and two lines at exactly 25.00 (EX-6035 and EX-6107). It wrote eight steps with the risk in each, and ten open points.
Two of them concern which lines count toward a split. It asked whether a line rejected for alcohol still counts toward the group total, and whether Mileage lines can form a split at all.
For Mileage it said it would leave them out, because they need no receipt.
We did not answer either question before the build, and Claude chose for itself.
Ask Claude to build it
Good, use that plan. Write one Python script, standard library only, that reads the file and writes decisions.csv with one row per line: claim_id, decision (approve, return or reject), rule (the number, 0 for approve), reason. Use Decimal for money and leave my file unchanged. Run it, then show me the count for each decision and every line that was not approved.
Claude Sonnet 5.5 (claude-sonnet-5-5) ran the prompts, one turn each. The script is standard library Python with money as Decimal. It approved 93 lines, returned 21 and rejected 6.
Its answers to the two open questions: a rejected alcohol line does count toward the group total, and Mileage lines do not.
Our key reads the rule as written, so every line with the same employee, merchant and date is in the group. Against that key the script matched 116 of 120 lines. All four misses are Mileage lines.
| Lines | Key, rule as written | First run | After the answer below |
|---|---|---|---|
| EX-6110 (a 12.00 sandwich; the same diner also bought a 14.00 glass of wine) | Return, rule 3 (26.00 together) | Return, rule 3 | Approve |
| EX-6004, EX-6015 (two Personal car trips, 13.40 and 20.10) | Return, rule 3 (33.50 together) | Approve | Approve |
| EX-6069, EX-6104 (two Personal car trips, 12.06 and 16.75) | Return, rule 3 (28.81 together) | Approve | Approve |
| EX-6041, EX-6054 (salad 14.00 and soup 12.00; a 6.00 bar tab on the same day) | Return, rule 3 | Return, rule 3 | Return, rule 3 (26.00 without the bar tab) |
| EX-6072 (the 6.00 bar tab) | Reject, rule 1 | Reject, rule 1 | Reject, rule 1 |
The same prompts in a second session gave the opposite answer on Mileage. That script counted the trips, returned all four lines and matched the key on all 120 lines (89 approved, 25 returned, 6 rejected).
Say which lines count
Here are my answers on splits. A line rejected under rule 1 does not count toward a split. Mileage lines do not count toward a split. Change the script, run it again, and tell me which lines changed decision.
In the first session one line changed: EX-6110 went from returned to approved, because the wine line no longer counted and a lone 12.00 sandwich is under the limit.
The Mileage lines were already out. The counts became 94 approved, 20 returned and 6 rejected, and the script matched a second key, which applies the two answers, on all 120 lines.
The second session moved five lines to approved (the four trips and the sandwich) and landed on the same 94, 20 and 6.
Both scripts write a reason in words on every line of the decision file. Neither records who changed a rule or when.
What ChatFin's build or buy page says
ChatFin's agents write back only drafts that a person approves through the official API, and every action carries an audit trail from prompt to prepared payload (Build vs Buy: Finance AI Agents in 2026, read on 3 Nov 2026).
We did not run this rule through ChatFin.
How we checked it
1. Plant the limit rows and keep the key
The 120 lines belong to eight made-up employees. Ten groups of two or three lines were planted on purpose: four that total exactly 25.00, three that total 25.01 and three spread over two days.
Six single lines sit at 24.99, 25.00 and 25.01. Claude worked in a folder that held no key, and its saved transcripts never open or name one. Five of the groups:
| Group | Decision in the key |
|---|---|
| Ines Duarte, Pine Street Stationers, 5 Oct: 9.00, 10.00 and 6.00 | EX-6001, EX-6030, EX-6059 approved. The total is 25.00, which is at the limit. |
| Jonas Weber, the same shop, 13 Oct: 10.00, 6.01 and 9.00 | EX-6018, EX-6040, EX-6115 returned under rule 3. The total is 25.01. |
| Rui Santos, Northgate Print: 14.00 on 15 Oct, 13.00 on 16 Oct | EX-6092 and EX-6084 approved. Two days, so two groups of one. |
| Tara Okafor, Harbor Parking, 20 Oct: 15.00 with a receipt, 14.00 without | EX-6044 and EX-6080 approved. One receipt in the group ends the split. |
| Rui Santos, Pine Street Stationers, 21 Oct: toner 26.00 and pens 5.00 | Toner returned: it is over the 25.00 limit on its own. Pens approved: the 5.00 pens line is a group of one. |
2. Small files for the edges
We ran 25 one-case files through each script after the third prompt. Seven of them:
| What we sent | First script | Second script |
|---|---|---|
| 25.00 and 0.01, same day, no receipts | Both returned | Both returned |
The same two lines with the merchant typed Shop and SHOP | Both returned | Both returned |
14.00 and 13.00, one description says Glass of wine | Wine rejected, 13.00 approved | Wine rejected, 13.00 approved |
| Two Mileage lines, 20.10 and 13.40 | Both approved | Both approved |
| An amount of 0.00 | Stops, names the line | Approves it |
An expense date typed 31/10/2026 | Stops, names the line | Approves it |
| A blank receipt flag | Stops, names the line | Stops, names the row |
On these 25 files the two scripts agree on the rule.
3. Compare with the reference code
We generated 3,000 random lines (ten employees, six merchants, four days, a spread of amounts around 25.00) and compared both scripts with the reference code that built the keys, so this adds volume and combinations and shares our reading of the rule.
The first script agreed on every line. The second script differed on 27, and all 27 are Mileage lines. It leaves Mileage out of the total, which is the answer we gave, but then returns a Mileage line that shares an employee, merchant and day with a real split.
In the 120-line file Mileage lines only appear under the merchant Personal car, so the file could not show it.
4. Take these to your policy owner
- Do Mileage lines count toward a split? EX-6004 and EX-6015 are two Personal car trips of 13.40 and 20.10.
- Does a rejected line count toward the total? Our answer was no.
- Rui Santos bought 14.00 on 15 Oct and 13.00 on 16 Oct from the same shop. The rule says the same date, so both lines pass. Is a split across two days a split?
- Is the merchant the same when it is typed in a different case? Both scripts said yes.