# aashvi2627/nova-freight-audit architecture

> Architecture diagram of the GitHub repository aashvi2627/nova-freight-audit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aashvi2627/nova-freight-audit
- Repository: https://github.com/aashvi2627/nova-freight-audit

## Overview

Nova is a mailbox-based freight-invoice audit harness for accounts payable. It ingests batches, extracts contract, invoice, shipment and email facts, audits for billing issues and portfolio risks, then emits findings with evidence and actions; feedback persists across batches. The graph emphasizes the harness runtime and its principal document-to-report stages. The excerpts do not show every orchestration call, so uncertain runtime links are dashed; grader, evaluation and submission tooling are excluded.

Main entry points: [`harness/nova_audit/report.py`](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/report.py) (Report Builder), [`harness/nova_audit/model.py`](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/model.py) (Fact Model), [`harness/nova_audit/engine.py`](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/engine.py) (Audit Rules), [`harness/harness.py`](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/harness.py) (Harness Commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Document Intake"]
  node_cli["Harness Commands<br/>[harness.py]"]
  node_docread["Document Parsing<br/>[docs.py]"]
  node_emailread["Email Extraction<br/>[emails.py]"]
  node_ocr["Scan OCR<br/>[ocr.py]"]
  node_llm["Claude Extraction<br/>[llm.py]"]
end

subgraph group_audit["Audit Analysis"]
  node_facts["Fact Model<br/>[model.py]"]
  node_engine["Audit Rules<br/>[engine.py]"]
  node_shared["Shared Utilities<br/>[util.py]"]
end

subgraph group_state["State and Feedback"]
  node_statefile[("Persistent State<br/>[store.py]")]
  node_feedback["Feedback Learning<br/>[feedback.py]"]
end

subgraph group_results["Reporting"]
  node_reporter["Report Builder<br/>[report.py]"]
  node_reportout["Audit Report"]
end

node_ap(("Accounts Payable"))
node_mailbox["Mailbox Batches"]
node_claude{{"Claude API"}}

node_ap -.->|"provides batches"| node_mailbox
node_mailbox -.->|"submits batches"| node_cli
node_ap -.->|"requests audit"| node_cli
node_cli -.->|"loads or saves"| node_statefile
node_statefile -->|"invokes scan reading"| node_ocr
node_statefile -->|"uses text layer"| node_docread
node_emailread -->|"uses document facts"| node_docread
node_emailread -->|"requests extraction"| node_llm
node_ocr -->|"uses vision fallback"| node_llm
node_llm -.->|"sends extraction"| node_claude
node_facts -->|"parses parts"| node_docread
node_facts -->|"reads messages"| node_emailread
node_facts -.->|"uses helpers"| node_shared
node_engine -.->|"audits facts"| node_facts
node_engine -.->|"uses email facts"| node_emailread
node_engine -.->|"uses helpers"| node_shared
node_reporter -->|"gets audit items"| node_engine
node_reporter -->|"loads history"| node_statefile
node_reporter -->|"applies decisions"| node_feedback
node_cli -.->|"builds report"| node_reporter
node_reporter -.->|"renders results"| node_reportout
node_ap -.->|"reviews actions"| node_reportout

click node_cli "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/harness.py"
click node_docread "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/docs.py"
click node_emailread "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/emails.py"
click node_ocr "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/ocr.py"
click node_llm "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/llm.py"
click node_facts "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/model.py"
click node_engine "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/engine.py"
click node_shared "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/util.py"
click node_statefile "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/store.py"
click node_feedback "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/feedback.py"
click node_reporter "https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/report.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_docread,node_emailread,node_ocr,node_llm toneBlue
class node_facts,node_engine,node_shared toneAmber
class node_statefile,node_feedback,node_claude toneMint
class node_reporter,node_reportout toneRose
class node_ap,node_mailbox toneIndigo
```

## Components

### Document Intake

- [Harness Commands](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/harness.py): `harness/harness.py`
- [Document Parsing](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/docs.py): `harness/nova_audit/docs.py`
- [Email Extraction](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/emails.py): `harness/nova_audit/emails.py`
- [Scan OCR](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/ocr.py): `harness/nova_audit/ocr.py`
- [Claude Extraction](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/llm.py): `harness/nova_audit/llm.py`

### Audit Analysis

- [Fact Model](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/model.py): `harness/nova_audit/model.py`
- [Audit Rules](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/engine.py): `harness/nova_audit/engine.py`
- [Shared Utilities](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/util.py): `harness/nova_audit/util.py`

### State and Feedback

- [Persistent State](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/store.py): `harness/nova_audit/store.py`
- [Feedback Learning](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/feedback.py): `harness/nova_audit/feedback.py`

### Reporting

- [Report Builder](https://github.com/aashvi2627/nova-freight-audit/blob/main/harness/nova_audit/report.py): `harness/nova_audit/report.py`
- **Audit Report**

### Other components

- **Accounts Payable**
- **Mailbox Batches**
- **Claude API**

## Connections

- Accounts Payable → Mailbox Batches: provides batches (evidence: `README.md`)
- Mailbox Batches → Harness Commands: submits batches (evidence: `README.md`)
- Accounts Payable → Harness Commands: requests audit (evidence: `README.md`)
- Harness Commands → Persistent State: loads or saves (evidence: `harness/harness.py`)
- Persistent State → Scan OCR: invokes scan reading (evidence: `harness/nova_audit/store.py`)
- Persistent State → Document Parsing: uses text layer (evidence: `harness/nova_audit/store.py`)
- Email Extraction → Document Parsing: uses document facts (evidence: `harness/nova_audit/emails.py`)
- Email Extraction → Claude Extraction: requests extraction (evidence: `harness/nova_audit/emails.py`)
- Scan OCR → Claude Extraction: uses vision fallback (evidence: `harness/nova_audit/ocr.py`)
- Claude Extraction → Claude API: sends extraction (evidence: `harness/nova_audit/llm.py`)
- Fact Model → Document Parsing: parses parts (evidence: `harness/nova_audit/model.py`)
- Fact Model → Email Extraction: reads messages (evidence: `harness/nova_audit/model.py`)
- Fact Model → Shared Utilities: uses helpers (evidence: `harness/nova_audit/model.py`)
- Audit Rules → Fact Model: audits facts (evidence: `harness/nova_audit/engine.py`)
- Audit Rules → Email Extraction: uses email facts (evidence: `harness/nova_audit/engine.py`)
- Audit Rules → Shared Utilities: uses helpers (evidence: `harness/nova_audit/engine.py`)
- Report Builder → Audit Rules: gets audit items (evidence: `harness/nova_audit/report.py`)
- Report Builder → Persistent State: loads history (evidence: `harness/nova_audit/report.py`)
- Report Builder → Feedback Learning: applies decisions (evidence: `harness/nova_audit/report.py`)
- Harness Commands → Report Builder: builds report (evidence: `harness/harness.py`)
- Report Builder → Audit Report: renders results (evidence: `harness/nova_audit/report.py`)
- Accounts Payable → Audit Report: reviews actions (evidence: `README.md`)
