Three-Way Match Skill

Before the payment run: every vendor invoice checked against its PO and what was actually received. Approve the clean ones, hold the rest with the reason, catch re-sent duplicates, and get the received-not-billed list for month-end.

Three-Way Match Skill cover

What it catches

SituationCodeLevel
Invoice line matches PO price and received quantityapprove
Invoice line with no PO numberno_pohold
PO number not in the PO filepo_not_foundhold
Invoice vendor isn't the PO vendor (suffixes like Inc./LLC ignored)vendor_mismatchhold
Item not on the PO (freight, fees, substitutions)item_not_on_pohold
Unit price over the PO beyond tolerance (default 2% / 0.01)price_over_pohold
Billed more than received to datebilled_not_receivedhold
Billed more than orderedbilled_over_pohold
Qty x price doesn't equal the line amountline_math_errorhold
Same vendor + same invoice number (C-5501 vs C5501 vs 0C-5501)duplicate_invoicehold
Same vendor, date and total under a different numberpossible_duplicate_invoicehold
Unit price under the PO (missing charge or credit?)price_under_poinfo
Received but not invoiced (GRNI accrual candidate)received_not_invoicedinfo
PO line partly received and billed for what arrivedpartial_receiptinfo

Proven on a labeled example

examples/harbor-point-october/ is a fictional restaurant group's October: 9 PO lines from 3 vendors, receiving, and 11 vendor invoices with 13 planted situations (a re-sent duplicate, a same-day double bill, billing for cups that never arrived, a price creep, a fee not on the PO, an invoice from the wrong vendor, a PO that doesn't exist, a line that doesn't add up and more). expected.json labels the outcome an AP reviewer would reach: 3 invoices to approve, 8 to hold, 85.00 of GRNI. The tests assert the tool reaches exactly that in any row order, honors your tolerance, and that a clean month exits 0.

What you get

Outputs in out/: invoices.csv (approve/hold per invoice with reasons), exceptions.csv (review queue, holds first), grni.csv (received not invoiced, with accrual value), report.md, summary.json. Exit 0 = every invoice can be approved; 1 = at least one hold; 2 = an input problem (the message says which flag fixes it).

Real Three-Way Match Skill report and passing tests from the labeled example

Quick start

./run_tests.sh
python3 -m threewaymatch --pos examples/harbor-point-october/purchase_orders.csv \
  --receipts examples/harbor-point-october/receipts.csv --invoices examples/harbor-point-october/invoices.csv --name "Harbor Point" --out out/

Inputs

  • PO lines CSV: PO number, vendor, item/SKU, qty, unit price (QuickBooks, Xero, NetSuite, Odoo, Excel exports all work; map odd headers with --map-po price="Cost Each").
  • Receiving CSV: PO number, item, qty received, date (receiving log, packing slips, GRN export).
  • Vendor invoice lines CSV: invoice number, vendor, date, PO number, item, qty, unit price, optional line amount (bill line export or an AP inbox extraction).

Use it from your agent

  • Claude Code plugin: this folder is a plugin (.claude-plugin/plugin.json). Try it with claude --plugin-dir ./three-way-match-skill, or add the folder to your own plugin marketplace.
  • Skill only: copy skills/three-way-match/ into ~/.claude/skills/ (or your agent's skills folder) and keep this folder where the agent can run python3 -m threewaymatch.
  • No agent: the CLI works on its own; --help lists every flag.

Honest limits

  • CSV only: it doesn't read PDFs or connect to your ERP. Extract invoice lines first (your AP tool or your agent can).
  • Matches on PO number + item code. If vendors invoice under their own SKUs, add a column with your item code or map it.
  • One currency; no unit-of-measure conversion (case vs each).
  • Received quantities are totals to date, not dated against each invoice.
  • It never approves, pays or edits anything; possible_duplicate_invoice is a lead to check, not a verdict.
  • Not accounting or audit advice.

Requirements

Python 3.9+ (tested on 3.10 and 3.13), no dependencies.

Format and license

Zip, 17 KB, v1.0, 15 files. Use and modify it for yourself and for clients you serve; no resale or redistribution of the kit itself. Full terms in LICENSE.txt.

FAQ

Does it read PDF invoices?
No; CSV lines. Your AP tool or agent can extract lines first.
QuickBooks/Xero/NetSuite?
Any CSV export of PO lines, receipts and bill lines.
Does it approve or pay?
Never; it sorts invoices into approve/hold for a person.
How do I get the files?
Right after payment, Stripe’s confirmation page shows your download link.
Refunds?
Email hello@youraitools.co within 14 days if it doesn’t work and we can’t fix it.
Can I pay with crypto?
Yes. Pay the same price in USDC or USDT on Base, Ethereum, Arbitrum, Optimism, Polygon or Solana from the "Pay with crypto" button, with no account or KYC. We check the payment on-chain and show your download links as soon as it confirms.

Get Three-Way Match Skill

Three-way match vendor invoices to POs and receipts: approve/hold queue, price and qty variances, duplicate invoices, GRNI accruals. Offline. $29.

Save with a bundle

Pairs well with

Download$19

Expense Report Audit Skill

Audit expense reports against your policy: duplicate and split charges, over-limit meals and hotels, missing receipts, mileage over the IRS rate. Offline. $19.

View Expense Report Audit Skill
Download$12

QuickBooks Online Journal Entry Import Checker

Check a journal entry CSV before importing it into QuickBooks Online: unbalanced entries, rejected account names, A/R and A/P lines with no name. $12.

View QuickBooks Online Journal Entry Import Checker

Related