Ledgic
Paper goes in. Posted comes out.

Open-source accounts-payable automation for operators running many locations on one ledger. Supplier invoices arrive as PDFs or phone photos from the receiving dock. A vision model reads every field and reports how sure it is, and code checks each line against the purchase order, the goods receipt and the contract price. Clean invoices post to QuickBooks or NetSuite with no human touch. Everything else waits in an exception queue with the evidence and a recommendation attached.
The model reads; it never decides. Every money figure, verdict and recommendation comes from plain Decimal code, and three agents built on the OpenAI Agents SDK work around it. One turns page images into a strict schema with a confidence for each field. One drafts vendor notices with tool calls, and the draft is thrown away if it contains a dollar amount the match engine did not produce. The Ask Ledgic copilot answers from contracts and policy through hybrid retrieval, pgvector and Postgres full-text search fused by rank, and names the clause it relied on. Every model call reserves its cost in Postgres first, under a hard $0.50 daily cap that fails closed. When the budget runs out, the copilot falls back to quoting the retrieved passages verbatim instead of failing.
There is no workflow engine. A Python state machine keeps each run in Postgres, workers claim runs with FOR UPDATE SKIP LOCKED, and failed stages retry with backoff before landing in a dead-letter queue. When a person has to decide, the run parks. The decision itself is a database function that checks the role, the $5,000 manager limit and segregation of duties, writes a hash-chained audit row, and wakes the run with LISTEN/NOTIFY in the same transaction. Row-level security covers every table, and the same tools are exposed as an MCP server, so Claude Desktop or Cursor can explain a held invoice while the database still refuses a decision the token's user is not allowed to make.
- tests passing in CI
- 378
- 265 pytest and 113 pgTAP on the latest GitHub Actions run
- hard daily LLM budget
- $0.50
- reserved in Postgres before each call; when it is spent, nothing is invented
- MCP tools
- 8
- for Claude Desktop or Cursor; permissions checked by the database





