Invoice intake agent
Two Claude agents watch the accounts mailbox: one decides which emails are supplier invoices, the other reads them and hands you a Sage Intacct bill to check and post - or to key in from the entry sheet.
What it does, in four steps
- Sorts the mailbox. The classification agent looks at each new email and its attachments and labels it Invoice Incoming or Not an invoice, so statements, remittances and quotes are never read as invoices. It runs when you click Check inbox now or on a timer - or you drop a file on the page yourself.
- Reads each invoice. The extraction agent sends every PDF or image labelled as an invoice to Claude, which fills in the supplier, invoice number and dates, every line, the VAT treatment including the domestic reverse charge, CIS and retention, and checks that the sums add up. An invoice written into the email itself, or inside an email forwarded with an empty covering note, is read the same way.
- Turns it into a Sage bill. The invoice is matched to a type - subcontractor, materials supplier, plant hire, professional services or overheads - which sets its GL and VAT coding, fills in CIS, retention and terms where the invoice is silent, and decides which checks apply. Vendor, project and payment terms come from your coding maps. Anything it cannot match becomes a check to fix before approval.
- You review and post. Open the invoice, compare the fields with the document and the Key into Sage sheet, approve it, then post it to Intacct as a draft or key it in by hand. A CSV of everything drops into the purchase invoice log.
It runs on the accounts machine, not in the cloud. Once started, it lives at http://localhost:8765 in your browser. API keys, the Gmail token and every invoice stay in the data folder on that machine. This website only hands out the downloads.
The agent tree
How an email travels through the app. The same tree is a page in the app, with each box showing its model, last run and counts; there, clicking a box opens it. Here, a box jumps to its explanation.
-
Gmail mailbox
search: has:attachment is:unread
- new mail matching the search
Agent - Classification
labels “Invoice Incoming” / “Not an invoice”
- labels “Invoice Incoming”
Agent - Invoice Extraction
one Sage bill per document
- files each document, labels “Invoices/Processed”
Inbox - review
approve when the checks are clear
- approve, then post or key in Sage Intacct JSON / XML / CSV downloads
- files each document, labels “Invoices/Processed”
Inbox - review
approve when the checks are clear
- labels “Not an invoice” Stops here
- labels “Invoice Incoming”
Agent - Invoice Extraction
one Sage bill per document
- new mail matching the search
Agent - Classification
labels “Invoice Incoming” / “Not an invoice”
Agent - Classification
Reads the new mail that matches the search and decides, from the attachments first and the email text second, whether it carries a supplier invoice, credit note or application for payment. Forwarded emails and attached timesheets are opened and read too, so an invoice with no PDF is not missed, while a statement of account is left alone. It labels each email so nothing is looked at twice, and lists every decision with its reason on its tab.
Its tab holds the model choice, the instructions the AI is given (shown word for word, editable, with a Restore default button), the Gmail search, an optional sender filter, the two labels, and a reference text for your own notes: which suppliers send applications for payment, senders whose mail is never an invoice, anything it has got wrong before.
Agent - Invoice Extraction
Reads every email labelled as an invoice, sends each PDF or image to Claude with the fixed invoice record, re-checks the arithmetic, matches the invoice to a type and maps it to a Sage Intacct bill in the Inbox.
Its tab holds the model choice, its own instructions (editable, with a Restore default button), the processed label, the timer for automatic runs, and its own reference text: project and site codes, how particular suppliers word things, CIS and retention conventions. The record it fills in is listed field by field.
Invoice types
Five generic types come filled in for a UK contractor - subcontractor, materials supplier, plant hire, professional services and overheads - each with its GL and VAT overrides, CIS and retention defaults, payment terms and its checks. An invoice is matched by supplier name, then by CIS, reverse charge or application-for-payment signals, then by what its lines mostly are; the review page can move it by hand.
Prompts and reference text
Nothing is hidden: each tab shows the prompt the AI is given and what is sent with each email, exactly as sent. The reference text is your own plain writing under it, empty to begin with, with examples of what to add. A short text goes with every call; a long one is split into paragraphs and only those that share words with the email are sent, so notes can grow with every supplier and project without costing more per invoice.
Download
The updater is the easy way: it fetches the app for you, keeps it up to date and starts it. The other downloads are zips straight from GitHub for doing it by hand.
update.bat (Windows) or update.command (Mac). Its page installs the latest version, updates it in one click without losing your data, installs older versions and starts the app. Needs Python 3 only.The pages
update.bat or update.command: the installed and latest versions, one-click install or update that keeps your data, older versions, and Start the app.
Get it running
One machine, one browser tab. The first start takes a minute or two while it sets itself up; after that it starts straight away.
- Have Python 3 on the machine (3.11 or newer). On Windows, install it from python.org and tick Add python.exe to PATH in the installer. Macs and Linux machines usually have it already.
- Download the updater above, unzip it, and keep the Invoice agent folder on the desktop.
- Double-click
update.bat(Windows) orupdate.command(Mac; if it will not open, right-click it, choose Open, then Open again). Its page opens in your browser: click Install the latest version, then Start the app. On Windows the app runs in the black window that opens - leave it open while you work; closing it stops the app. - The app opens at
http://localhost:8765by itself once it is ready. The Inbox tells you what still needs connecting. Next time, the same double-click tells you if there is a new version and starts the app.
Prefer to do it by hand? Download the latest build, unzip it, and double-click run.bat (Windows) or, on a Mac, open Terminal, type bash (with a space), drag run.sh into the window and press Enter.
Set up
Keys and the Sage coding live on the Settings page; each agent has its own tab. Every key field is masked; the eye button reveals it so you can check a paste.
- Claude. Paste an API key from the Claude Console. Test key checks it without spending tokens. Both agents use this key; each picks its own model on its tab, Claude Opus 5 by default.
- Gmail. In Google Cloud Console create a project, enable the Gmail API, create an OAuth client ID of type Desktop app, paste its client ID and secret, save, then click Connect Gmail and sign in as the invoices mailbox. If Google reports
redirect_uri_mismatch, create the client as Web application instead and add the redirect URI shown on the Settings page. - The agents. On Agent - Classification check the Gmail search and the labels, and add what helps it decide. On Agent - Invoice Extraction add what helps it read: project codes, supplier quirks. Both start with sensible settings and the shipped instructions, so this step can wait until the first invoices have been through; the instructions themselves can be edited on the tab and put back with Restore default.
- Sage coding. The Settings page comes filled with generic contractor codes: nominal accounts per line category, CIS and retention control accounts, Intacct's UK VAT tax detail names and payment terms. Replace them from your Intacct lists - vendor names to vendor IDs, GL accounts, tax details, project codes - and check the Invoice types tab does the same. Anything unmapped shows up as a check on the invoice, where you can type the ID directly.
- Sage Intacct connection (optional). With Web Services credentials an approved invoice can be posted straight in as a draft bill. Without them everything still works: entry sheet, JSON, XML and CSV.
The classification agent labels every email it has judged, and the extraction agent marks each email it has read as read and labels it Invoices/Processed; all three labels are excluded from the next search, so nothing is looked at twice. Applying Invoice Incoming to an email by hand in Gmail pushes it through. Only PDF, PNG, JPG and WEBP attachments are read; images under 20 KB are treated as logos and skipped.