K∴

kar-tally

deterministic budget-cap ledger auditor
ONE FILE · RUNS IN YOUR BROWSER WORKS OFFLINE NO AI JUDGE

Start here

Kar-Tally tells you whether an AI agent really stayed within its budget: it recomputes every balance in the agent's spend ledger from the cap down, to the cent, and names each balance that does not add up, each missing or repeated entry and each point where the cap was exceeded. It runs entirely in this page: nothing you paste is sent anywhere, and no AI judges anything.

  1. Paste a spend ledger as JSON above (a cap and a list of entries), or press one of the Load buttons: a clean sample, a hidden overspend, a deleted entry, an edited balance.
  2. Press Verify ledger.
  3. Read the verdict: PASS only when every entry adds up; FAIL names each violation by row and sequence number, and the first row where the cap was exceeded.
  4. Keep the report: Download verification report, with the SHA-256 fingerprint of the ledger it checked.

Below the tool: how it works · words on this page · blueprint · roll it out · for a business · FAQ

1 What this is

An AI agent (or any automated system) is given a spending cap and a log of actions it took, each with a cost and a running balance it claims to have left. kar-tally recomputes that log from scratch — cap minus cumulative cost, step by step — and reports whether the claimed numbers are actually consistent with the raw entries, whether the sequence has any gaps or duplicates, and whether the cap was ever exceeded at any point, even if a later entry's claimed balance was edited to hide it.

There is no model in the loop. The verdict is pure arithmetic and comparison over the numbers you give it — anyone can take the same entries and cap, redo the same three checks by hand, and get the identical PASS/FAIL. That's the whole proof.

! Limits: what it does not check

It proves a ledger adds up: every balance follows from the cap and the costs before it. It does not know whether the ledger matches what really happened outside this page (the real API bill, the real token meter); check it against the provider's invoice or the server logs for that. It also trusts that each seq number stands for one real event: an entry invented with a consistent cost, balance and the next sequence number looks like a real one to arithmetic. Balances are compared to the cent, so a claimed 59.995 counts as 60.00. It is a check that the numbers you were handed agree with each other, not a live billing feed.

2 Ledger input

balance = the claimed running balance after this entry's cost is deducted.

3 Verification result

NOT RUN Click "Verify ledger" to recompute the entries on the left.
  • No violations to show yet.
#seqactoractioncostclaimed bal.recomputedok
SHA-256 fingerprint of this input—

4 Live self-test

Runs six known ledgers — one clean, five deliberately tampered in different ways — through the exact same verifyLedger() function above, and checks that each one is judged the way it honestly should be. This is the end-to-end proof that the auditor actually catches what it claims to catch.

View the exact verifier source running on this page

    

How it works

the agent's ledgerrecomputed fromthe cap, to the centevery entry checkedPASS, or FAILwith each violation
  1. It starts from the cap and subtracts each entry's cost in order, counting exactly to a millionth of a unit, so many sub-cent costs add up (500 costs of 0.004 make 2.00).
  2. For each entry it checks that the sequence number follows the last one, that the claimed balance equals the recomputed one to the cent, that the recomputed balance never goes below zero, and that every field is there and well formed.
  3. It reports PASS or FAIL with every violation named, and a SHA-256 fingerprint of the input so anyone can re-check the same ledger.

Words on this page

Ledger
The agent's list of what it spent: for each entry a sequence number, who acted, what it did, the cost, and the balance it says was left.
Cap
The budget the agent started with. Every balance is recomputed from it, entry by entry.
Sequence number
Each entry's place in the list (1, 2, 3…). A gap means an entry was deleted; a repeat means one was inserted or copied.
Kernel
The small piece of code that decides every verdict; the rest of the page only shows what it decided. Here it is the block inside this page, copied byte for byte into kernel.mjs (the file the tests run) and into the script, so all three are the same code.
SHA-256 receipt
A 64-character fingerprint of the input and the verdict. Anyone with the same input gets the same fingerprint; change one character and it changes completely.
Deterministic
No AI model, no random numbers and no clock go into a verdict, so the same input gives the same verdict on any machine, every time.
No AI judge
No language model decides anything. The verdict comes from fixed rules you can read in kernel.mjs.
Mutation gate
A test of the tests. witness makes small deliberate changes to the kernel, one at a time: for example it turns if (count > 0) into if (count >= 0), then runs the tests. Every change must make a test fail. A change no test notices has survived: it would mean no test checks what happens at that exact point. A change reviewed as equivalent cannot alter any result (both versions give the same answer for every input), and the reason is written down and checked.
CI
Continuous integration: GitHub re-runs every test and the gate on its own computers on every change, and the runs are public.
In the browser
The page does the work on your computer. Nothing you paste is sent to a server.
MIT licence
An open-source licence: you may use, copy, change and build products with it, free, as long as the copyright notice stays.
Sourced figures
Every number in the cost case comes from a published source (the UK median wage and UK inflation, from the ONS), linked under the table.

Blueprint

Roll it out

  1. Pick one place where this check is done by hand today, or skipped, and the person who owns it.
  2. Try it here on real examples from that place. Nothing leaves the page.
  3. Put it in the flow. Run node scripts/kar-tally.mjs ledger.json in CI or a script (Node.js 20 or later, no dependencies). Exit code 0 means PASS, 1 means FAIL, 2 means the input could not be used (a cap that is not a number, for example). An AI agent can run the same script as a skill.
  4. Keep the receipts with the work they checked, so anyone can recompute a verdict later.
  5. Measure the difference with the cost case below.

For a business

Kar-Tally turns a check that is usually done by eye, or not at all, into a verdict anyone can recompute: the same input gives the same answer and the same SHA-256 receipt on any machine, with no AI judging it.

The cost case, on your numbers

What the checking costs today against running the tool. Staff time is at the UK median hourly wage with on-costs left out, so this is a floor; later years rise with UK inflation (CPI). Change any box to your own numbers and the table recalculates as you type.

How it is worked out. Today: checks a year (per week × 52) × minutes per check × the median hourly wage, plus anything you pay for a tool now. With the tool: the share it replaces takes the seconds you enter instead of the minutes, and the rest is still checked by hand. Each later year rises by one more year of inflation.

yearchecking by handwith Kar-Tallysaved

Against what you do now

Security, data protection and deployment

Support and ownership

Supplied by AI Native Solutions; start through that site. Support, any service level, warranty and liability are agreed per deployment, in each deployment's agreement. The software is MIT and keeps running without us.

Where it stops, answered straight

The case for the board

A check that anyone can recompute replaces a check that has to be trusted, at no licence cost, without sending your data anywhere. Its logic is the code on this page, and its tests are themselves tested.

FAQ

What does a hidden overspend look like?
An agent with a cap of 50 spends 40, then 30, and writes its next balance as 5. Kar-Tally recomputes 10, then -20: it names the row where the cap was exceeded and the balance that was rewritten.
Can an agent run it?
Yes. The same kernel ships as a one-file Node.js script (scripts/kar-tally.mjs), usable as an agent skill before it reports what it spent.
What does a ledger look like?
JSON with a cap and a list of entries, for example {"cap": 500, "startSeq": 1, "entries": [{"seq": 1, "actor": "agent-1", "action": "api_call:search", "cost": 40.00, "balance": 460.00}, {"seq": 2, "actor": "agent-1", "action": "api_call:generate", "cost": 75.50, "balance": 384.50}]}. The Load buttons above fill in four ready-made ones. If your log is a CSV or uses other field names, map it to this shape first.
What is the fingerprint for?
It is the SHA-256 of the exact ledger checked. Anyone holding the same file gets the same fingerprint, so a finance reviewer can confirm the report is about exactly the ledger they have, and that it was not changed after.
What happens with bad, empty or very large input?
A ledger with no entries, or none at all, is a FAIL with the reason named. A cap that is not a number, or a file that is not valid JSON, is refused (exit 2). A cost that is negative, missing or written as text is a violation on its row; so is a sequence number that is not a whole number. A cap too large to count exactly to a millionth is a FAIL that says so, never a rounded answer.
What do I need to run it?
For the page, a modern browser; there is nothing to install. For the script, Node.js 20 or later (free from nodejs.org; node --version shows which one you have): download scripts/kar-tally.mjs (one file, no dependencies, no npm install) and run it with no arguments to see how to call it.
Does it need the internet or an account?
No. The page works once loaded, and the script runs offline. Nothing is uploaded.