Inspiration I kept noticing the same failure mode in enterprise finance: contracts have exact pricing terms, but nobody re-checks an invoice against them line by line. A vendor drops a discount or bumps a rate two months early, and it just looks like a normal bill. I wanted to treat a contract like source code and an invoice like a test run against it.
What it does LedgerHawk compiles a contract (MSA, amendments, even an executed email) into a typed pricing model, then replays every invoice against it with deterministic math. A mismatch surfaces as a failing test: the clause, the arithmetic, and the dollar delta, plus a ready-to-send dispute letter. On the seeded demo portfolio it catches all 14 planted billing errors ($86,420.40), with zero false positives on the other 46 clean invoices.
How we built it A compiler-style pipeline: Contract AST → Pricing DSL → a deterministic Virtual Billing Engine → Reconciliation → Evidence. LLMs only ever produce inspectable structure (the AST/DSL, risk annotations, negotiation prose) — never a dollar figure. Every invoice's expected cost is:
Expected
∑ i r i ⋅ q i ⋅ ( 1 + e ) t i Expected= i ∑ r i ⋅q i ⋅(1+e) t i
for rate (r_i), quantity (q_i), and escalation (e) over elapsed periods (t_i) — plain Decimal arithmetic, unit-tested like payroll code. React + FastAPI on top, with a static export so the whole demo runs on GitHub Pages with no backend.
Challenges we ran into Getting multi-document precedence right (which of an MSA, three amendments, and an email actually governs a given month) took the most iteration. A close second: keeping every dollar figure traceable to a specific clause and computation, so a "finding" is never just a vague anomaly score.
Accomplishments that we're proud of Zero false positives across 60 invoices while catching all 14 planted errors — a leakage-detection tool is only useful if it doesn't also cry wolf. I'm also proud the entire money path has no LLM in it at all, provably, in code anyone can read.
What we learned How much of "trustworthy AI for finance" is really an architecture decision, not a prompting one: keep language and arithmetic in separate, separately-verifiable stages, and trust follows from that split, not from a bigger model.
What's next for LedgerHawk Live contract extraction from arbitrary uploaded PDFs (today's demo vendors ship as pre-extracted fixtures on purpose), real ERP connectors beyond the mock/CSV ones, and multi-tenant support for teams to run this against their actual vendor contracts.
Built With
- css
- fastapi
- gemini
- git
- github
- github-actions
- groq
- javascript
- oxlint
- pdfplumber
- postgresql
- pydantic
- pytest
- python
- react
- react-router
- recharts
- reportlab
- ruff
- sqlalchemy
- sqlite
- tailwindcss
- uvicorn
- vite
- vitest
Log in or sign up for Devpost to join the conversation.