# Tallywise

Company accounting and tax, with the AI model kept out of the sums.

- Wisdom Engineers
- Sole-authored
- Sep 26
- [Company case study](https://wisdomengineers.ie/work/tallywise/)

## The problem

A small Irish company keeps its books in PDFs: bank statements, supplier invoices, order emails and screenshots, many of them with no fixed layout. A VAT3 return is due every two months, and every figure on it has to be defensible to Revenue. I had never worked in accounting or tax, and in this domain a wrong number is not a bug report. It is a misstatement in a statutory return.

## The constraints

- Only what is printed. The model may report only what is on the page. A fact that is not there is left empty, never guessed, because an invented figure is worse than a missing one.
- No judgement for the model. It decides no VAT treatment, no account and no currency conversion. Those are code, working from the facts it reports and a ruleset kept by hand.
- A person reviews every AI reading, and it is saved before any run of the books uses it.
- Filed returns are history. A change takes effect only when a named person accepts it with a date.

## What I built

A deterministic double-entry system in Python. Fourteen fixed extractors, each written for one supplier's layout, read the documents that have one. Anything else goes to a queue, where a narrow agent reads one document at a time and reports strict JSON that a person reviews and commits. No run of the books calls the model: every later run reads the reviewed file and never asks it again.

Plain code does the rest. It posts the journal, computes the bimonthly VAT3 figures, reconciles them against what was filed, works out corporation tax and exports one workbook per financial year. Two runs over unchanged inputs give byte-identical output, and a bank line with no rule stops the run and names the line rather than falling into a catch-all account, because a silent fallback is how a set of books drifts away from the bank.

## The measured outcome

First commit, 18 September 2026. Two days later, on 20 September, the first returns filed from its figures were acknowledged: reconciliation had surfaced one error repeated across six of the company's VAT3 returns, and all six were amended as a self-correction, with EUR 2.75 of interest paid. At that point the repository held 21 commits and 28 test files, all mine. By 22 September it held 25. As of 15 October 2026 it has read 88 purchase documents, 73 by fixed code and 15 by the model, and 9 bank statements with 104 bank lines. For seven filed VAT3 periods the computed figures agree with what was filed on every box, and nothing is outstanding. 606 tests, all passing.

## What was handed over

A README that states what the system does not do as plainly as what it does: it prepares figures, and a person files them. A working paper beside each return, stating where each figure came from. And the rule the next person inherits rather than rediscovers: the model reads, code decides, and a named person signs any change to a filed return.

[Read the method behind it](https://piotrgospodarczyk.com/method)
