Glent Group invoice intake

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.

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.

Download the updater
Unzip it, keep the Invoice agent folder on the desktop and double-click 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.
Download the latest build
Always the newest version on the main branch.
Looking up published versions…

The pages

The Inbox page: the last check of the mailbox, and a ledger table with two invoices from Northbank Mechanical Services, their net, VAT and gross totals, zero open checks and a Needs review status
Inbox. Every document that came in, with its totals, the number of open checks and its status. Check inbox now runs both agents; the counters filter the list; Download log CSV sits at their right.
The Agent tree page: boxes for the Gmail mailbox, the classification agent, the extraction agent, the Inbox and Sage Intacct, joined by lines labelled with what passes between them, each box showing its model, last run and counts
Agent tree. The mailbox, the two agents, the Inbox and Sage, with the labels that carry an email from one to the next. Each box shows its model, its last run and its counts; clicking one opens it.
The Agent - Classification page: the result of a run, the model choice and the reference text box
Agent - Classification. Model, the instructions the AI is given with their Restore default button, the reference text, the Gmail search and the labels it applies, with Classify now at the top and every recent decision listed below.
The Agent - Invoice Extraction page: the result of a run, the model choice and the reference text box
Agent - Invoice Extraction. Model, its instructions with their Restore default button, the reference text, the processed label and the timer, with Extract now at the top and the invoice record it fills in listed field by field.
The review page: the line editor on the left and the Key into Sage entry sheet on the right, showing the vendor, invoice type, dates, bill number, project and the coded lines
Review. The extracted data on the left is editable and the line editor recalculates new lines. On the right sits the Key into Sage sheet, in the order of Intacct's bill screen, with the invoice type that coded it.
The Invoice types page: the Subcontractor type with its matching rules, GL account per line category and VAT tax details
Invoice types. One sheet per type: what it covers, how it is matched, its GL and VAT overrides, deductions, checks and posting options. Add your own or remove the ones you do not use.
The updater page: installed and latest versions both v3.2, an Up to date notice, Start the app and Check again buttons, and a log of the download and install
Updater. Its own small page, opened by 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.
The Settings page: masked API key field with a reveal button and the Gmail OAuth client fields
Settings. Every key is pasted here and masked; the eye button reveals it so you can check a paste. Connect Gmail saves the page and opens Google's sign-in. The Sage coding below comes pre-filled with generic contractor codes.

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.

  1. 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.
  2. Download the updater above, unzip it, and keep the Invoice agent folder on the desktop.
  3. Double-click update.bat (Windows) or update.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.
  4. The app opens at http://localhost:8765 by 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.