Pranav GudiseCode on GitHub

AP Auto-forward Gate

A tool for the end of week 2 of an Agave AP Automation onboarding at a general contractor. It reads an export of the AI's suggested invoice coding and AP's final coding, and answers two questions.

Week-2 gate on the synthetic sample

1. Which jobs have earned auto-forward to the PM?

5of 8 jobs

A job qualifies when AP accepted the suggested job, cost code, cost type and commitment unchanged on at least 90% of at least 20 checked invoices.

2. Which invoices must AP still clear before they sync to Sage, even on those jobs?

53of 110 invoices after the window

21 hit one of 8 rules that apply on every job; 32 are on jobs not yet on auto-forward. The other 57 go from PM approval straight to the daily sync.

J101 Apparel flagship fit-outCapital improvement · Most corrected: cost type
16 of 18 straight to sync
AUTO-FORWARD
J102 Restaurant fit-outCapital improvement · Most corrected: job
13 of 15 straight to sync
AUTO-FORWARD
J103 Hospitality venue renovationCapital improvement · Most corrected: cost code
14 of 16 straight to sync
AUTO-FORWARD
J104 Store refresh (repair work)Repair · Most corrected: cost codeBelow the 90% bar.
0 of 12 straight to sync
FULL REVIEW
J105 Department store shop-in-shopCapital improvement · Most corrected: cost type
14 of 16 straight to sync
AUTO-FORWARD
J106 Fast-casual restaurant (legacy cost codes)Capital improvement · Most corrected: cost codeBelow the 90% bar.
0 of 15 straight to sync
FULL REVIEW
J107 Showroom build-outTax status unknown · Most corrected: cost typeClears the coding bar, but AP still clears every invoice: its tax status was never recorded.
0 of 12 straight to sync
AUTO-FORWARD
J108 Store maintenance (repair work)Repair · No correctionsOnly 9 checked invoices; the gate needs 20.
0 of 6 straight to sync
FULL REVIEW
Auto-forward to the PM, then syncAP review: hit a ruleAP review: job not on auto-forwardEach square is one invoice. Select one to find it in the AP queue.

Why AP still clears an invoice

Each rule puts an invoice in AP's queue before sync, whatever its job's status. Counts are the 110 invoices received after the gate window.

RuleInvoices
Job tax status unknown
The job was never recorded as a capital improvement or repair at kickoff, so the tax rules cannot run
12
Overbilling
The invoice would bill a contract line past its scheduled value
3
No PO or subcontract match
Nothing to inherit cost codes from, so coding is a judgment call
1
Unallocated amount
Coded lines do not add up to the invoice total, net of tax
1
New vendor
Vendor added to the vendor master after the pilot started
1
Possible duplicate
Same vendor and invoice number (any letter case), or same vendor and amount within 14 days
1
No tax on materials
A supplier invoice with no sales tax, so check the exemption or accrue use tax
1
Sub charged tax on capital improvement work
Under New York rules a subcontractor on a capital improvement job (Form ST-124 on file) should not charge sales tax
1
Job not yet on auto-forward
No other reason: the job has not earned auto-forward
32

AP queue

Invoices AP clears before sync, and why.

InvoiceReceivedJobVendorTotalReasons
INV-01572026-12-21J104V3056,833.03Job not yet on auto-forward
INV-02272026-12-21J106V3016,921.11Job not yet on auto-forward
INV-01502026-12-22J104V3054,457.87Job not yet on auto-forward
INV-02652026-12-22J107V3021,415.18Job tax status (capital improvement or repair) not recorded at kickoff
INV-02712026-12-22J107V3021,737.07Job tax status (capital improvement or repair) not recorded at kickoff
INV-02862026-12-22J108V3068,779.57Job not yet on auto-forward
INV-90012026-12-22J101V203612.40No PO or subcontract match
INV-90022026-12-22J102V30448,476.43Would bill the contract line past its scheduled value
INV-90032026-12-22J103V2011,306.50Coded lines do not add up to the invoice total (net of tax)
INV-90042026-12-22J105V399870.98Vendor added to the vendor master after the pilot started
INV-90062026-12-22J105V202940.00Materials invoice with no sales tax: check the exemption or accrue use tax
INV-90072026-12-22J103V3035,443.75Subcontractor charged sales tax on a capital improvement job (ST-124 on file)
INV-01522026-12-23J104V2011,843.85Job not yet on auto-forward
INV-02262026-12-23J106V3024,732.34Job not yet on auto-forward
INV-02372026-12-23J106V3052,297.90Job not yet on auto-forward
INV-02672026-12-23J107V3062,806.69Job tax status (capital improvement or repair) not recorded at kickoff
INV-02722026-12-23J107V203163.82Job tax status (capital improvement or repair) not recorded at kickoff
INV-02292026-12-24J106V3028,156.95Job not yet on auto-forward
INV-02302026-12-24J106V3021,548.64Job not yet on auto-forward
INV-02312026-12-24J106V3061,649.24Job not yet on auto-forward
INV-90052026-12-24J101V3066,581.89Same vendor and invoice number, or same vendor and amount within 14 days
INV-02332026-12-25J106V3066,352.72Job not yet on auto-forward
INV-01472026-12-28J104V2031,980.80Job not yet on auto-forward
INV-01492026-12-28J104V3026,796.72Job not yet on auto-forward
INV-02322026-12-28J106V3052,155.85Job not yet on auto-forward
INV-02662026-12-28J107V3045,327.90Job tax status (capital improvement or repair) not recorded at kickoff
INV-02682026-12-28J107V3065,236.29Job tax status (capital improvement or repair) not recorded at kickoff
INV-02692026-12-28J107V3053,832.87Job tax status (capital improvement or repair) not recorded at kickoff
INV-02852026-12-28J108V3017,676.71Job not yet on auto-forward
INV-01542026-12-29J104V3067,513.69Job not yet on auto-forward
INV-01562026-12-29J104V2021,632.08Job not yet on auto-forward
INV-02362026-12-29J106V201876.94Job not yet on auto-forward
INV-02382026-12-29J106V3028,796.94Job not yet on auto-forward
INV-02402026-12-29J106V3015,457.50Job not yet on auto-forward
INV-02622026-12-29J107V203778.09Job tax status (capital improvement or repair) not recorded at kickoff
INV-02872026-12-29J108V3056,573.40Job not yet on auto-forward
INV-01482026-12-30J104V3018,912.82Job not yet on auto-forward
INV-01512026-12-30J104V2022,538.18Job not yet on auto-forward
INV-01552026-12-30J104V3044,783.30Job not yet on auto-forward
INV-02282026-12-30J106V2031,139.64Job not yet on auto-forward
INV-02632026-12-30J107V3045,243.95Job tax status (capital improvement or repair) not recorded at kickoff
INV-02642026-12-30J107V3047,709.36Job tax status (capital improvement or repair) not recorded at kickoff
INV-02702026-12-30J107V3046,966.67Job tax status (capital improvement or repair) not recorded at kickoff
INV-02882026-12-30J108V3055,510.45Job not yet on auto-forward
INV-00802026-12-31J102V3047,834.12Would bill the contract line past its scheduled value
INV-02732026-12-31J107V2031,526.47Job tax status (capital improvement or repair) not recorded at kickoff
INV-02832026-12-31J108V3055,893.70Job not yet on auto-forward
INV-02842026-12-31J108V3015,109.35Job not yet on auto-forward
INV-01532027-01-01J104V3057,492.88Job not yet on auto-forward
INV-01582027-01-01J104V3047,137.87Job not yet on auto-forward
INV-02342027-01-01J106V3056,867.67Job not yet on auto-forward
INV-02352027-01-01J106V3043,706.31Job not yet on auto-forward
INV-02392027-01-01J106V201891.54Would bill the contract line past its scheduled value

How it fits Agave's AP workflow

On an auto-forwarded job Agave still sends every invoice to the PM. AP writes each rule above as a plain-language auto-tagging rule in Agave and clears every tagged invoice before the daily sync. In this tool's output, AP REVIEW means AP touches the invoice before it reaches the ERP, and AUTO-FORWARD TO PM means it goes from PM approval to the daily sync with no AP touch.

It is built around how Agave's AP Automation is documented to work (AP draft check, PM approval, auto-forward set per project, auto-sync set per account), so a team can switch auto-forward on job by job while AP keeps daily sync and clears tagged invoices first. Agave already checks for duplicates on its own; the tool repeats that rule so the eval covers every reason an invoice reaches AP.

Eval

Hand-labeled eval set30 invoices after a gate window
30of 30 match
0 unsafe auto-forwards
PASS

eval/ holds 30 hand-written invoices after a gate window, each labeled by hand with the route and tags it should get, covering every rule and its edge cases (exactly at the scheduled value, one cent unallocated, 14 versus 15 days for duplicates, tax on repair versus capital improvement jobs, invoices that hit several rules). The pass bar is 30 of 30 and zero unsafe auto-forwards.

The first run scored 27 of 30. All three misses were errors in the eval set, not the tool: two cases reused an amount from an earlier case for the same vendor, which the duplicate rule correctly caught, and one sat exactly on the 14-day boundary before I had decided whether day 14 counts; I settled on "within 14 days" including day 14 and moved the case. The cases were fixed and the run is now 30 of 30 with zero unsafe auto-forwards.

The labels are written by hand and kept apart from the code, but they follow the same rules the code implements, so the eval checks that the code does what the rules say, not that the rules are right.

Limits

  • Each invoice is coded to one line; split coding would compare each line.
  • Once a contract line is overbilled, later invoices on it are tagged too until AP clears the line. Overbilling compares the invoice net of tax with the line's scheduled value. It does not model retainage or change orders not yet in the ERP.
  • The tax rules are a screen, not tax advice: they decide which invoices a person looks at.