ChatFin/Build Expense Claim Checks with Claude

How to build expense claim checks using Claude

By Ashok ManthenaPublished 5 Nov 20269 min read
Three rows of expense_claims.csv (EX-4001 for 300.00 USD, EX-4029 for 88.00 EUR, EX-4037 for 75.01 USD) go into Claude. The same three claims come out in decisions.csv: EX-4001 approved, EX-4029 returned under rule 4, EX-4037 returned under rule 7. A note reads 41 of 41 claim lines matched our reference answers.
You need
Expense claim lines, as one CSV file
Tested with
Claude Sonnet 5.5, made-up data, 5 Nov 2026
Result
41 of 41 claim lines matched our reference answers

Before you start

Somebody in finance opens the expense queue, reads each line, and sends back the ones that break policy. Most of the policy is arithmetic: a date, a limit, a receipt.

A few rules need the whole file in front of you, because you cannot tell that a line is a repeat or a split from the line alone.

That is the kind of job that waits in a developer's queue. On 5 Nov 2026 we wrote the seven rules down in plain English and Claude wrote the checker.

The file we used has 41 lines from 8 employees. The seven rules do not cover per diems by city, limits by grade, tax, or approvers who make exceptions. Each of those would be another rule that somebody has to add, test and explain when an employee asks why a claim came back.

Our view is that mid size and large companies should not build and maintain this. Each change to the policy is a change to the script, and the list of alcohol words, the limits and the 60 days all live in code. For the trade-off, read Build vs Buy: Finance AI Agents in 2026.

What you need

An ERP connection

You need the claim lines with their dates, categories, amounts, currency and receipt flag. Check how your expense tool exports them.

If you read them straight from your ERP or expense system, check what its API terms allow first. The result also has to go somewhere a person can act on it.

Our script reads one CSV file and writes one. It pays nothing and sends nothing.

The data points

Columns in expense_claims.csv
ColumnUsed for
claim_idOne decision per line
employee_id, merchant, amount, expense_dateRepeats (rule 3) and splits (rule 6) are found by comparing these across lines
claim_date, expense_dateThe 60 day limit
descriptionThe alcohol words
currency, receiptNon-USD and the 25.00 receipt rule
category, attendees, nights, milesThe limits for meals, lodging and mileage

A plan, broken into steps

Attach expense_claims.csv and paste this.

Prompt 1: plan
I work in the finance team. I want a small tool that reviews employee expense claim lines before we pay them.

I have one file, expense_claims.csv (claim_id, employee_id, employee, claim_date, expense_date, category, merchant, description, amount, currency, receipt, attendees, nights, miles). One row is one expense line. receipt is Y or N. attendees, nights and miles are filled only where they apply.

Our policy:
1. Reject a line whose expense_date is more than 60 days before its claim_date.
2. Reject a line whose description mentions alcohol (wine, beer, cocktail, spirits or bar tab).
3. Reject a line that repeats an earlier line from the same employee with the same merchant, amount and expense_date. The earlier line is judged on its own.
4. Return a line to the employee if the currency is not USD.
5. Return a line over 25.00 that has no receipt. Mileage lines do not need a receipt.
6. Return every line of a split: the same employee, merchant and expense_date with two or more lines that are each 25.00 or less, together more than 25.00, and no receipts.
7. Return a line over its limit: Meals 75.00 per attendee, Lodging 220.00 per night, Mileage must equal miles times 0.67 to the cent.
8. Otherwise approve.
A line can break more than one rule. Report the first rule it breaks, in the order above.

Do not write code yet. Break the job into numbered steps. For each step say what could go wrong. Then list anything in the policy that is unclear.

Claude gave ten steps and said what could go wrong in each. It spotted that rules 3 and 6 need the whole file, so it would work out the groups first and decide each line second.

It named the lines in our file that sit on a boundary, such as EX-4015 at exactly 60 days and EX-4032 at 25.01. It noticed that EX-4041 breaks two rules, and said the report must show rule 1.

Claude also made a mistake. It said the file has 40 lines, and it has 41. The script it wrote later read all 41, so nothing was lost, but a miscount in a plan is a reason to check every number a chat model quotes.

It then listed fifteen open points. Four of them change which claims come back:

  • If a line repeats an earlier line that was itself rejected or returned, is it still a repeat? Claude assumed yes.
  • Do lines that are already rejected count towards a split? Claude proposed that only lines that get as far as rule 6 count.
  • Two identical coffees bought on the same day by the same person look like a repeat. Is that intended?
  • Does the alcohol rule match whole words or any text, and in the description only? Claude chose whole words and the description.

Settle before relying on it. We did not answer them. We told Claude to use its plan, and it used its own suggestion for each. Your policy owner decides all fifteen.

Ask Claude to build it

Prompt 2: build and run
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 exact decimal arithmetic for money. Never change my file. Run it, then show me how many lines got each decision, every line that was not approved, and the total amount approved.

Claude Sonnet 5.5 (claude-sonnet-5-5) ran both prompts on 5 Nov 2026. The first run took the prompts one at a time, as two turns. The script is 212 lines of Python, standard library only, with money as Decimal.

Claude said it confirmed with a checksum that the input file was unchanged. It approved 22 lines, returned 12 and rejected 7, and the approved total was 3,357.44 USD. Here are the 19 lines that were not approved, grouped by rule:

Lines that were not approved
LinesDecisionWhat the script saw
EX-4021, EX-4022, EX-4041Reject, rule 161, 120 and 76 days old. EX-4041 also mentions beer, and rule 1 comes first.
EX-4023, EX-4024Reject, rule 2The descriptions say wine and cocktail.
EX-4026, EX-4028Reject, rule 3Same employee, merchant, amount and date as EX-4025 and EX-4027, which are approved.
EX-4029, EX-4030Return, rule 4Euro and pound claims.
EX-4031, EX-4032, EX-4033Return, rule 5Over 25.00 with no receipt. EX-4032 is 25.01.
EX-4034, EX-4035, EX-4036Return, rule 6One shop, one day, 14.00 + 13.00 + 11.50 = 38.50, no receipts.
EX-4037 to EX-4040Return, rule 7A meal of 75.01 for one person, 260.00 for three, a hotel at 230.00 a night, and 100 miles claimed at 70.00 instead of 67.00.

Where to run it

The people who need the result are the employees whose claims come back and whoever owns the policy. They need a page or an email, and a CSV is hard to read for that.

Somebody has to own the list of alcohol words and the limits, and each run needs to be recorded so you can say later why a line was rejected. A hosting service such as Vercel is one option. Nothing here was hosted.

If you would rather buy it

ChatFin's build or buy page says it writes back only drafts a person approves through the official API. We did not run this policy through ChatFin. ChatFin also has pages titled AI Agents for Expense and Travel Audit and AI for Expense Report Validation.

Test it before you trust it

1. Plant the answer and keep the key

We built the 41 lines so that every rule is broken at least twice, with lines on each side of each limit except the split total, and our reference code produced the expected answers.

The key was not in Claude's folder. All 41 decisions and rule numbers matched. A second run, in a fresh session with the same two prompts answered in order, wrote a different 236-line script and matched on all 41 too.

Made-up data. The key comes from our own reading of the policy. We designed the lines to hit its edges, and some descriptions hint at them, such as "boundary 60 days". A match shows the script follows the written rules on these lines. It says nothing about your claims.

2. Try the edges of each rule

We ran 38 small files through the first script. The eleven rows show 32 of them. The other six are more mileage amounts, a split where one line is over 25.00, a currency typed usd and an empty file, and all behaved as the policy reads.

Edge case results
What we sentWhat the script did
An expense 60 days before the claim date; then 61 daysApproved; rejected under rule 1
25.00 with no receipt; then 25.01Approved; returned under rule 5
A meal of 75.00 for one person; 75.01. A hotel night at 220.00; 220.01Approved at the limit, returned one cent over
Mileage, 12.5 miles claimed at 8.38 and at 8.378.38 approved (8.375 rounds up), 8.37 returned
Beermat printing as a description; Team bar tab on a mealBeermat approved, the bar tab rejected under rule 2. The script matches whole words only
Two identical lines from one employee; from two employees; same amount a day apart; merchant typed SHOP and ShopSecond line rejected; both approved; both approved; second rejected
A repeat of a line that was itself returned for being in eurosThe repeat is rejected under rule 3. Rule 3 comes before rule 4
Three lines of 10, 11 and 12 with no receipts; three that total exactly 25.00; three that total 25.01All three returned; all approved; all three returned
A split made of Mileage lines; a split where one line has a receipt; a split on two different daysAll approved
A line that is 61 days old, in euros and has no receiptReject, rule 1 only
Amount of 0.00 or 1,000.00; date written 31/10/2026; receipt typed Yes; a meal with no attendees; a repeated claim_id; an expense dated after the claimStopped with a message naming the line. No output file

Each boundary the policy states came out as written. The choices to take to your policy owner are the ones where the policy is silent.

Beermat is approved because the script matches whole words. A repeat of a returned line is rejected. A mileage claim below the right amount is returned. A bad line stops the whole run.

3. Compare it with a second implementation

We wrote our own version of the seven rules and made 3,000 random lines from ten employees, twelve merchants and a spread of dates, amounts and receipts. With the word Beermat left out, the two versions agreed on 2,975 lines.

The other 25 are all rule 6, in both directions: our version counted lines toward a split that Claude's script leaves out (lines already rejected, and Mileage), and the reverse.

When we changed our version to Claude's reading of which lines count, the 25 went to zero. With Beermat in, the two disagree on 328 lines, because our version rejects any description containing "beer".

4. Take the gaps to your policy owner

Whole word or any match for the alcohol list, what counts towards a split, what "earlier" means for repeats, and what happens to a claim in a currency your company also pays. Add your answers to the prompt and run the same file again.

Where ChatFin fits

The script shows how far seven rules and one file get you in a sitting. Around it you still need the feed from the expense system, a way to return a line to an employee with the reason, an approval step for exceptions, and a person to change the rules when the policy changes.

ChatFin's build or buy page puts the upkeep of connectors, models and controls on the vendor, not on your backlog (Build vs Buy: Finance AI Agents in 2026).