DEV Community

Hibat Errahmane Gholal
Hibat Errahmane Gholal

Posted on

LedgerGuard: Investigating the Ghost in Financial Transactions

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

Financial discrepancies are not always obvious. A payment may be allocated to the wrong invoice, a delivery may not match an order, or records across different systems may contradict each other.

I built LedgerGuard, an AI-powered financial reconciliation and investigation platform, for the Hacktoberfest 2026 DEV Challenge — Week 4: Ghost in the Machine.

What does LedgerGuard do?

LedgerGuard combines deterministic reconciliation with AI-assisted investigation to help identify and understand inconsistencies across business records.

Key capabilities include:

  • Reconciliation engine: Detects quantity, operational, and financial discrepancies.
  • Cross-record checks: Identifies suspicious relationships between deliveries, invoices, and payments.
  • AI investigation: Uses evidence from business records to explain discrepancies and suggest what should be checked next.
  • Analytics center: Presents financial and operational trends.
  • Notifications: Highlights currently active discrepancies.
  • Audit trail: Records investigation notes and status changes.

Open-source AI

LedgerGuard uses Llama 3.2 (3B) through Ollama, running locally.

The AI is an investigation assistant, not the source of truth. The deterministic reconciliation engine identifies discrepancies, while the AI helps interpret the available evidence.

This local-first approach avoids dependence on paid inference APIs and demonstrates how open-weight models can support practical business applications.

Why this project?

A discrepancy is not automatically proof of fraud, theft, or human error.

LedgerGuard aims to make investigations more transparent by separating verified facts from possible explanations and missing information. Human verification remains essential.

Technology stack

  • Python
  • FastAPI
  • React
  • PostgreSQL
  • Ollama
  • Llama 3.2 (3B)

Demo

Source code

GitHub logo hibat-errahmane / LedgerGuard

LedgerGuard is a deterministic financial and operational reconciliation engine that detects inconsistencies across orders, deliveries, invoices, payments, and credit notes. Built with Python and PostgreSQL, it identifies discrepancies, validates transactions, tracks corrections, and generates reconciliation reports with transaction-safe processing.

LedgerGuard — AI-Powered Financial Reconciliation & Investigation

LedgerGuard is an AI-assisted reconciliation and investigation platform designed to help businesses detect financial inconsistencies, trace operational discrepancies, and investigate suspicious transaction records.

It combines a deterministic reconciliation engine with a locally hosted open-weight language model. The reconciliation engine identifies discrepancies using business rules and database evidence; AI helps explain the evidence and suggest investigation steps while keeping human reviewers in control.

The Problem

Business records are often distributed across orders, deliveries, invoices, credit notes, and payments. Inconsistencies between these records can be difficult to detect and investigate manually.

Examples include:

  • Ordered quantities that do not match recorded deliveries.

  • Delivery quantities allocated incorrectly to invoice items.

  • Payments allocated to invoices belonging to different customers.

  • Overallocated payments and overpaid invoices.

  • Credit-note inconsistencies.

LedgerGuard aims to make these discrepancies traceable, understandable, and easier to investigate.

Key Features

1. Deterministic Reconciliation

  • Order-to-delivery quantity reconciliation.

  • Delivery-to-invoice consistency…

What I learned

Building LedgerGuard helped me explore the engineering challenges of financial reconciliation, database integrity, evidence-based AI investigation, and integrating a locally running language model into a full-stack application.

Open innovation matters because developers and students should be able to experiment with AI systems, inspect their behavior, and build useful applications without depending entirely on proprietary services.

Top comments (0)