invoice-disputes.md · Agentic workflows
Invoice dispute workbench
Help an accounts-receivable analyst investigate short-paid invoices, obtain exact approval and verify a simulated credit, even after an interrupted response.
- Next.js
- TypeScript
- Fastify
- PostgreSQL
- pg-boss
- LangGraph
- Claude
- Docker Compose

A customer pays USD 9,000 against a USD 10,000 invoice and disputes ten missing units. Shipping and receiving disagree. An accounts-receivable analyst needs to investigate the evidence, a controller needs to decide the adjustment, and the accounting result needs to be checked.
This workbench keeps those steps in one reviewable case. It exists to prevent an understandable customer complaint from becoming an unsupported, stale or duplicate credit.
Editorial archive date: 10 September 2026. Implementation, screenshots and results were reviewed on 24 October and come from October work.

Framed queue detail from the real packaged app. Synthetic data, simulated ledger and rules-only assessment; captured on 22 October.
How it works
The analyst gathers invoice, payment, agreement and delivery records. An optional Claude investigator reads scoped evidence and proposes a cited assessment. The controller establishes the accepted quantity and price, then approves a specific calculated credit.
Approval is tied to the exact evidence and ledger versions. A material change requires another review. Execution uses a durable operation key; after a lost response, reconciliation finds the existing action instead of blindly posting again. The case closes only after the ledger readback matches.

The recovery view verifies the original simulated credit. No new cash was collected.
What the evidence shows
Recorded verification passed 346/346 workflow assertions and 4/4 packaged browser scenarios, including an interrupted-credit story. A process-kill test and a separate restore proof preserved the original action. The model evaluation was less complete: rules passed every assertion in 46/46 cases, Haiku in 42/46 and Sonnet in 43/46. Results and limits
This is a local demonstration with synthetic data, fixture identities and simulated credits. A separate ERPNext sandbox reader imports snapshots; the workbench does not post to a real ERP. No customer benefit or analyst time saving has been measured.
Run it from the public repository, or read the article on approval and recovery.