Pick the Accounts to Flag in Flux, With Claude
- 6160 Rent 80,000.50 to 88,000.55
- 6310 Relocation 30,000 to 35,000.01
- 6070 Postage 0.00 to 6,200.00
- Rent 10.00% not flagged
- Relocation 5,000.01 flagged
- 17 of 60 accounts flagged
- You need
- A trial balance with August 2026, September 2026 and September 2025, as CSV
- Tested with
- Claude Sonnet 5.5, made-up data, 5 Nov 2026
- Result
- All 59 accounts the rule settles match the key, both runs
60 accounts, 15 built on the edges
On 5 Nov 2026 we gave Claude a rule with two limits, a change of more than 10 percent and more than 5,000.00.
The rule: more than 10 percent and more than 5,000.00
Flag an account when September 2026 is more than 10 percent and more than 5,000.00 away from August 2026, in either direction. The percent is measured against August.
Fifteen of the 60 accounts were built on the boundaries: a change of exactly 10 percent, exactly 5,000.00 and one cent over it, an August of zero, a sign that flips, and accounts that pass one limit and fail the other. The figures are made up.
trial_balance_activity.csv and flux_flags.csv
The script Claude wrote reads trial_balance_activity.csv and writes flux_flags.csv.
| Column | Used for |
|---|---|
account, account_name, type | Row key and account type |
aug_2026, sep_2026 | The two months compared. Revenue is a negative number |
sep_2025 | Context only. The rule does not use it |
Ask Claude for a plan first
Attach your own export with the columns above and paste this.
I run the monthly flux review for our controller. I have one file, trial_balance_activity.csv, with 60 accounts and these columns: account, account_name, type, aug_2026, sep_2026 and sep_2025. Revenue accounts carry credit balances as negative numbers. Before anyone writes commentary I need the list of accounts that get commentary. My rule: flag an account when September 2026 is more than 10 percent and more than 5,000.00 away from August 2026, in either direction. The percent is measured against August. The sep_2025 column is there for context. Do not write code yet. Break the job into numbered steps. For each step say what could go wrong. Then list anything in my rule that is unclear.
Run 1 gave eight steps and run 2 gave seven, each with eight unclear points, and both named the accounts that sit on a limit.
Run 1 listed Rent (exactly 10.00 percent), Training and development (exactly -10.00 percent) and Interest income (exactly 5,000.00), and said a float calculation could flag or skip them at random. Five of the eight needed our answer:
- An August of zero. The percent is undefined. Run 1 asked whether Postage, which moves from 0 to 6,200.00, is flagged. Run 2 said it would flag it, since any move off zero is an infinite percent, and left the call to us.
- Sign flips. Freight out and Translation services start negative and end positive. Both runs measured the percent against the size of August.
- Whether "more than" is strict, and whether both limits must hold. Both read it as strict and as "and".
- Rounding. Run 1 asked whether the tests use exact figures or figures rounded to the cent, and cited Relocation, which passes the dollar limit by one cent. Run 2 asked whether the percent is tested as displayed (10.0) or exact.
- Whether September 2025 plays any part. Both treated it as context only, and run 1 asked whether a year-over-year swing should flag anything.
We left every one of these open and told Claude to use its plan.
Ask Claude to build it
Good. Use that plan. Write one Python script, standard library only, that reads the file and writes flux_flags.csv with one row per account: account, account_name, aug_2026, sep_2026, change, pct_change, flagged (Y or N). Use exact decimal arithmetic. Never change my file. Run it, then show me every flagged account with its change and percent, and the number flagged.
Claude Sonnet 5.5 (claude-sonnet-5-5) answered both prompts as two turns of one Claude Code session with the CSV in a working folder, and again in a new session.
Run 1's script is 64 lines of Python and run 2's is 47, both standard library only with money as Decimal. Each flagged 17 of the 60 accounts, wrote 60 rows, and said it had used its own defaults for the unanswered questions.
| Account | August | September | Change | Percent change | Flag | Why |
|---|---|---|---|---|---|---|
| 6160 Rent | 80,000.50 | 88,000.55 | 8,000.05 | 10.00 | No | Exactly 10 percent is not more than 10 percent |
| 7010 Interest income | 30,000.00 | 35,000.00 | 5,000.00 | 16.67 | No | Exactly 5,000.00 is not more than 5,000.00 |
| 6310 Relocation | 30,000.00 | 35,000.01 | 5,000.01 | 16.67 | Yes | One cent over |
| 6460 R&D tools | 100,000.00 | 110,010.00 | 10,010.00 | 10.01 | Yes | One hundredth of a percent over |
| 6190 Training | 70,000.00 | 63,000.00 | -7,000.00 | -10.00 | No | Down exactly 10 percent |
| 6230 Freight out | -2,000.00 | 1,500.00 | 3,500.00 | 175.00 | No | Sign flips, but only 3,500 |
| 6300 Translation | -8,000.00 | 6,000.00 | 14,000.00 | 175.00 | Yes | Sign flips, 14,000 apart |
| 6070 Postage | 0.00 | 6,200.00 | 6,200.00 | blank | Yes | August is zero. The rule does not say |
Both runs flagged Postage, the only account of the 60 where the rule gives no answer. Each wrote its percent as blank and flagged it on the dollar limit alone.
Checks: a key, 26 edge files, 3,000 random accounts
1. A key kept out of the working folder
Our own code applied the rule to all 60 accounts with exact decimals, and kept the key out of the folder we told Claude to work in.
We checked the change on every account, the percent on every account with a non-zero August, and the flag on the 59 accounts the rule settles. Neither run differed from the key anywhere, and both flagged the same 17.
The key is our reading of the rule, with the 15 boundary accounts chosen by us.
2. Edge cases
26 small files went through both scripts.
| What we sent | What happened |
|---|---|
| The exact 10 percent row, then 10.01 percent | No, then yes. Both runs |
| A change of 5,000.00, then 5,000.01 | No, then yes |
| August 0.00 and September 5,000.00; then 5,000.01; then 3,000.00 | No, yes, no. The percent is left blank |
| August 0.01 and September 5,000.02 | Yes, with a percent of 50,000,100.00 |
| August -8,000.00 and September 6,000.00 | Yes at 175 percent, so the percent is taken against the size of August |
| A credit balance from -400,000.00 to -452,000.00 | Yes, -13.00 percent |
Amounts typed 1e4 and 2e4 | Read as 10,000 and 20,000 |
An amount in quotes with a thousands separator, "80,000.00", or n/a in September | Both scripts stop with a Python error and write nothing. The error does not say which account |
| A blank August | Run 1 stops with the same Python error. Run 2 stops with a plain message, blank aug_2026 for account 1 |
| The same account number twice | Both stop, each with a message about the duplicate |
In Python float arithmetic the change on the Rent row is 8,000.050000000003 and the percent is 10.000000000000004, so a float version flags Rent. Both of Claude's scripts used exact decimals and left Rent off.
3. 3,000 random accounts against our own exact version
We made 3,000 random accounts. Of them, 869 sit within 0.06 points of the 10 percent line, 587 within 1.00 of the 5,000 line, and 145 have an August of zero, 65 of those with a September over 5,000.
Of the 2,855 accounts with a non-zero August, a float version of the rule would have flagged the wrong account on 5. Both scripts matched our exact version on every one of them.
They flagged all 65 August-zero accounts over 5,000, as they did Postage. The key and both scripts apply the same one-sentence rule, so the match does not test the rule itself.