# krishjain10/reconciliation-copilot architecture

> Architecture diagram of the GitHub repository krishjain10/reconciliation-copilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krishjain10/reconciliation-copilot
- Repository: https://github.com/krishjain10/reconciliation-copilot

## Overview

Reconciliation Copilot is a Streamlit application for reconciling merchant ledger batches against bank settlement payouts. Its principal workflow loads and validates CSV inputs, deterministically calculates expected net payouts and classifies batches, then anonymizes unresolved records before generating guarded explanations and confidence scores. The dashboard presents resolved, unresolved, orphan, and audit views; AI output is advisory. The graph also includes the documented golden evaluation capability. Edges rely on the README or shown source/index references; unsampled UI and agent wiring is not inferred beyond those references.

Main entry points: [`ui/app.py`](https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/app.py) (Dashboard Orchestrator), [`agent/explain.py`](https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/explain.py) (Explanation Agent), [`eval/golden_set.py`](https://github.com/krishjain10/reconciliation-copilot/blob/main/eval/golden_set.py) (Golden Evaluation), [`matching/engine.py`](https://github.com/krishjain10/reconciliation-copilot/blob/main/matching/engine.py) (Batch Matcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Reconciliation Workflow"]
  node_dashboard_app["Dashboard Orchestrator<br/>[app.py]"]
  node_csv_inputs["Ledger And Settlement CSVs"]
  node_csv_loader["CSV Loader<br/>[loader.py]"]
  node_batch_matcher["Batch Matcher<br/>[engine.py]"]
end

subgraph group_privacy_agent["Privacy And Explanations"]
  node_tokenizer["PII Tokenizer<br/>[anonymize.py]"]
  node_explanation_agent["Explanation Agent<br/>[explain.py]"]
  node_pii_guard["PII Guard<br/>[pii_guard.py]"]
  node_fallback_llm["Rule-Based LLM<br/>[mock_llm.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_views["Dashboard Views<br/>[components.py]"]
  node_dashboard_styles["Dashboard Styling<br/>[styles.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_golden_eval["Golden Evaluation<br/>[golden_set.py]"]
end

node_operator(("Finance Operator"))
node_llm_callable(("LLM Callable"))

node_operator -->|"runs reconciliation"| node_dashboard_app
node_dashboard_app -->|"accepts inputs"| node_csv_inputs
node_dashboard_app -->|"loads CSVs"| node_csv_loader
node_dashboard_app -->|"matches batches"| node_batch_matcher
node_dashboard_app -->|"anonymizes records"| node_tokenizer
node_dashboard_app -->|"explains mismatches"| node_explanation_agent
node_dashboard_app -->|"selects fallback"| node_fallback_llm
node_explanation_agent -->|"guards prompts"| node_pii_guard
node_explanation_agent -->|"requests explanation"| node_llm_callable
node_dashboard_app -->|"renders results"| node_dashboard_views
node_dashboard_app -->|"injects styles"| node_dashboard_styles
node_dashboard_app -.->|"runs evaluation"| node_golden_eval
node_golden_eval -->|"evaluates matching"| node_batch_matcher

click node_dashboard_app "https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/app.py"
click node_csv_inputs "https://github.com/krishjain10/reconciliation-copilot/tree/main/data"
click node_csv_loader "https://github.com/krishjain10/reconciliation-copilot/blob/main/ingestion/loader.py"
click node_batch_matcher "https://github.com/krishjain10/reconciliation-copilot/blob/main/matching/engine.py"
click node_tokenizer "https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/anonymize.py"
click node_explanation_agent "https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/explain.py"
click node_pii_guard "https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/pii_guard.py"
click node_fallback_llm "https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/mock_llm.py"
click node_dashboard_views "https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/components.py"
click node_dashboard_styles "https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/styles.py"
click node_golden_eval "https://github.com/krishjain10/reconciliation-copilot/blob/main/eval/golden_set.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_dashboard_app,node_csv_inputs,node_csv_loader,node_batch_matcher toneBlue
class node_tokenizer,node_explanation_agent,node_pii_guard,node_fallback_llm toneAmber
class node_dashboard_views,node_dashboard_styles toneMint
class node_golden_eval toneRose
class node_operator,node_llm_callable toneIndigo
```

## Components

### Reconciliation Workflow

- [Dashboard Orchestrator](https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/app.py): `ui/app.py`
- [Ledger And Settlement CSVs](https://github.com/krishjain10/reconciliation-copilot/tree/main/data): `data`
- [CSV Loader](https://github.com/krishjain10/reconciliation-copilot/blob/main/ingestion/loader.py): `ingestion/loader.py`
- [Batch Matcher](https://github.com/krishjain10/reconciliation-copilot/blob/main/matching/engine.py): `matching/engine.py`

### Privacy And Explanations

- [PII Tokenizer](https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/anonymize.py): `agent/anonymize.py`
- [Explanation Agent](https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/explain.py): `agent/explain.py`
- [PII Guard](https://github.com/krishjain10/reconciliation-copilot/blob/main/agent/pii_guard.py): `agent/pii_guard.py`
- [Rule-Based LLM](https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/mock_llm.py): `ui/mock_llm.py`

### Dashboard

- [Dashboard Views](https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/components.py): `ui/components.py`
- [Dashboard Styling](https://github.com/krishjain10/reconciliation-copilot/blob/main/ui/styles.py): `ui/styles.py`

### Evaluation

- [Golden Evaluation](https://github.com/krishjain10/reconciliation-copilot/blob/main/eval/golden_set.py): `eval/golden_set.py`

### Other components

- **Finance Operator**
- **LLM Callable**

## Connections

- Finance Operator → Dashboard Orchestrator: runs reconciliation (evidence: `README.md`)
- Dashboard Orchestrator → Ledger And Settlement CSVs: accepts inputs (evidence: `README.md`)
- Dashboard Orchestrator → CSV Loader: loads CSVs (evidence: `ui/app.py`)
- Dashboard Orchestrator → Batch Matcher: matches batches (evidence: `ui/app.py`)
- Dashboard Orchestrator → PII Tokenizer: anonymizes records (evidence: `ui/app.py`)
- Dashboard Orchestrator → Explanation Agent: explains mismatches (evidence: `ui/app.py`)
- Dashboard Orchestrator → Rule-Based LLM: selects fallback (evidence: `ui/app.py`)
- Explanation Agent → PII Guard: guards prompts (evidence: `agent/explain.py`)
- Explanation Agent → LLM Callable: requests explanation (evidence: `agent/explain.py`)
- Dashboard Orchestrator → Dashboard Views: renders results (evidence: `ui/app.py`)
- Dashboard Orchestrator → Dashboard Styling: injects styles (evidence: `ui/app.py`)
- Dashboard Orchestrator → Golden Evaluation: runs evaluation (evidence: `README.md`)
- Golden Evaluation → Batch Matcher: evaluates matching (evidence: `eval/golden_set.py`)
