How dasdristanta13/self_correcting_ledger_agent works
Self-Correcting Ledger Agent is a browser-based invoice reconciliation product. A user uploads a PDF, the service queues a job, extracts a ledger, checks its arithmetic, and—when discrepancies arise—searches invoice evidence, verifies proposed corrections, and revalidates before returning results and a trace. The SPA supports upload, invoice review, dashboard and audit workflows. The graph follows documented runtime stages and major UI capabilities; some frontend view internals and backend helpers were not sampled, so their connections are shown only where the README or excerpts support them.
Main entry points: graph.py Workflow graph · app.py Invoice API · client.ts API client · App.tsx SPA shell
Components 18
Browser application
- SPA shell
frontend/src/App.tsx - Invoice views
frontend/src/views - Upload workflow
frontend/src/components/BulkUpload.tsx - Job polling
frontend/src/hooks/useJobs.tsx - API client
frontend/src/api/client.ts
Job service
- Invoice API
src/ledger_agent/api/app.py - Job runner
src/ledger_agent/api/runner.py
Reconciliation workflow
- Workflow graph
src/ledger_agent/graph.py - PDF ingestion
src/ledger_agent/ingestion - Ledger extraction
src/ledger_agent/extraction/ledger.py - Arithmetic checks
src/ledger_agent/validation/arithmetic.py - Evidence audit
src/ledger_agent/agents/audit.py - Evidence retrieval
src/ledger_agent/retrieval/hybrid.py - Correction agent
src/ledger_agent/agents/reconciliation.py
Persistence and tracing
- Job and event store
src/ledger_agent/storage/chroma_store.py - Invoice vector indexes
src/ledger_agent/retrieval/chroma_vector.py - Trace sinks
src/ledger_agent/observability/sinks.py
Other components
- Invoice user
Connections 20
- Invoice user → SPA shell: uses
- SPA shell → Invoice views: renders
frontend/src/App.tsx - Invoice user → Upload workflow: submits PDF
- Upload workflow → API client: uploads file
frontend/src/components/BulkUpload.tsx - Job polling → API client: polls jobs
frontend/src/hooks/useJobs.tsx - API client → Invoice API: calls invoice API
- Invoice API → Job runner: queues job
src/ledger_agent/api/app.py - Job runner → Workflow graph: runs invoice
- Workflow graph → PDF ingestion: ingests PDF
src/ledger_agent/graph.py - Workflow graph → Ledger extraction: builds ledger
src/ledger_agent/graph.py - Workflow graph → Arithmetic checks: checks arithmetic
src/ledger_agent/graph.py - Workflow graph → Evidence audit: audits discrepancy
src/ledger_agent/graph.py - Workflow graph → Evidence retrieval: retrieves evidence
src/ledger_agent/graph.py - Workflow graph → Correction agent: applies corrections
src/ledger_agent/graph.py - Workflow graph → Arithmetic checks: revalidates
src/ledger_agent/graph.py - Invoice API → Job and event store: stores job state
src/ledger_agent/api/app.py - Invoice API → Trace sinks: records trace
src/ledger_agent/api/main.py - Workflow graph → Invoice vector indexes: builds index
src/ledger_agent/graph.py - Trace sinks → Job and event store: persists events
src/ledger_agent/api/main.py - API client → Invoice views: supplies results