# skygod07/recaller architecture

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

- Interactive diagram: https://gitdiagram.com/skygod07/recaller
- Repository: https://github.com/skygod07/recaller

## Overview

RECALLER is an AI-assisted credit-underwriting system for thin-file EV borrowers. A loan officer creates an application, supplies documents, and starts underwriting; the backend extracts evidence, holds low-confidence fields for officer review, reconciles sources, computes credit metrics deterministically, applies configured policy, and returns an auditable decision and memo. The console also supports replay, what-if analysis, and advisory agent review. The README and sampled references establish the main stage relationships; unsampled subsystems are included where documented, but their internal calls are not inferred.

Main entry points: [`recaller/orchestrator/pipeline.py`](https://github.com/skygod07/recaller/blob/main/recaller/orchestrator/pipeline.py) (Underwriting pipeline), [`recaller/app/service.py`](https://github.com/skygod07/recaller/blob/main/recaller/app/service.py) (Underwriting service), [`recaller/documents/router.py`](https://github.com/skygod07/recaller/blob/main/recaller/documents/router.py) (Extraction routing), [`frontend/src/pages/ApplicationPage.jsx`](https://github.com/skygod07/recaller/blob/main/frontend/src/pages/ApplicationPage.jsx) (Underwriting console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Officer console"]
  node_console["Underwriting console"]
  node_console_api["Console API client<br/>[http.js]"]
end

subgraph group_backend["Application backend"]
  node_api["HTTP API<br/>[api.py]"]
  node_service["Underwriting service<br/>[service.py]"]
  node_database[("Application database<br/>[db.py]")]
  node_jobs["Background jobs<br/>[jobs.py]"]
end

subgraph group_evidence["Evidence processing"]
  node_documents["Document reading<br/>[pdf.py]"]
  node_routing["Extraction routing<br/>[router.py]"]
  node_patterns["Pattern extraction<br/>[patterns.py]"]
  node_agent_extract["Evidence agent<br/>[adapter.py]"]
  node_extraction["Evidence and confidence<br/>[adapters.py]"]
  node_informant["Informant evidence<br/>[informant.py]"]
end

subgraph group_decision["Deterministic decision"]
  node_reconciliation["Evidence reconciliation<br/>[reconcile.py]"]
  node_credit["Credit calculations<br/>[engine.py]"]
  node_policy["Policy evaluation<br/>[engine.py]"]
  node_pipeline["Underwriting pipeline<br/>[pipeline.py]"]
  node_memo["Credit memo<br/>[memo.py]"]
end

subgraph group_support["Review and audit"]
  node_whatif["Scenario solver<br/>[solver.py]"]
  node_audit[("Audit ledger<br/>[audit.py]")]
end

node_officer(("Loan officer"))
node_model(("Model provider"))

node_officer -->|"uses"| node_console
node_console -->|"requests"| node_console_api
node_console_api -->|"calls backend"| node_api
node_api -->|"delegates"| node_service
node_service -->|"persists records"| node_database
node_service -->|"runs background work"| node_jobs
node_service -->|"runs underwriting"| node_pipeline
node_service -->|"reads uploads"| node_documents
node_documents -->|"routes documents"| node_routing
node_routing -->|"extracts fields"| node_patterns
node_routing -.->|"uses when enabled"| node_agent_extract
node_model -.->|"supplies model"| node_agent_extract
node_routing -->|"returns extracted fields"| node_extraction
node_pipeline -->|"extracts evidence"| node_extraction
node_pipeline -->|"reconciles evidence"| node_reconciliation
node_pipeline -->|"computes metrics"| node_credit
node_pipeline -->|"evaluates rules"| node_policy
node_pipeline -->|"generates memo"| node_memo
node_pipeline -->|"solves scenarios"| node_whatif
node_pipeline -->|"records stages"| node_audit
node_credit -->|"uses attested evidence"| node_informant

click node_console "https://github.com/skygod07/recaller/blob/main/frontend/src/pages/ApplicationPage.jsx"
click node_console_api "https://github.com/skygod07/recaller/blob/main/frontend/src/api/http.js"
click node_api "https://github.com/skygod07/recaller/blob/main/recaller/app/api.py"
click node_service "https://github.com/skygod07/recaller/blob/main/recaller/app/service.py"
click node_database "https://github.com/skygod07/recaller/blob/main/recaller/app/db.py"
click node_jobs "https://github.com/skygod07/recaller/blob/main/recaller/app/jobs.py"
click node_documents "https://github.com/skygod07/recaller/blob/main/recaller/documents/pdf.py"
click node_routing "https://github.com/skygod07/recaller/blob/main/recaller/documents/router.py"
click node_patterns "https://github.com/skygod07/recaller/blob/main/recaller/documents/patterns.py"
click node_agent_extract "https://github.com/skygod07/recaller/blob/main/recaller/ai/hermes/adapter.py"
click node_extraction "https://github.com/skygod07/recaller/blob/main/recaller/extraction/adapters.py"
click node_informant "https://github.com/skygod07/recaller/blob/main/recaller/extraction/informant.py"
click node_reconciliation "https://github.com/skygod07/recaller/blob/main/recaller/reconciliation/reconcile.py"
click node_credit "https://github.com/skygod07/recaller/blob/main/recaller/credit_engine/engine.py"
click node_policy "https://github.com/skygod07/recaller/blob/main/recaller/policy_engine/engine.py"
click node_pipeline "https://github.com/skygod07/recaller/blob/main/recaller/orchestrator/pipeline.py"
click node_memo "https://github.com/skygod07/recaller/blob/main/recaller/narration/memo.py"
click node_whatif "https://github.com/skygod07/recaller/blob/main/recaller/whatif/solver.py"
click node_audit "https://github.com/skygod07/recaller/blob/main/recaller/core/audit.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_console,node_console_api toneBlue
class node_api,node_service,node_database,node_jobs toneAmber
class node_documents,node_routing,node_patterns,node_agent_extract,node_extraction,node_informant toneMint
class node_reconciliation,node_credit,node_policy,node_pipeline,node_memo toneRose
class node_whatif,node_audit,node_officer,node_model toneIndigo
```

## Components

### Officer console

- [Underwriting console](https://github.com/skygod07/recaller/blob/main/frontend/src/pages/ApplicationPage.jsx): `frontend/src/pages/ApplicationPage.jsx`
- [Console API client](https://github.com/skygod07/recaller/blob/main/frontend/src/api/http.js): `frontend/src/api/http.js`

### Application backend

- [HTTP API](https://github.com/skygod07/recaller/blob/main/recaller/app/api.py): `recaller/app/api.py`
- [Underwriting service](https://github.com/skygod07/recaller/blob/main/recaller/app/service.py): `recaller/app/service.py`
- [Application database](https://github.com/skygod07/recaller/blob/main/recaller/app/db.py): `recaller/app/db.py`
- [Background jobs](https://github.com/skygod07/recaller/blob/main/recaller/app/jobs.py): `recaller/app/jobs.py`

### Evidence processing

- [Document reading](https://github.com/skygod07/recaller/blob/main/recaller/documents/pdf.py): `recaller/documents/pdf.py`
- [Extraction routing](https://github.com/skygod07/recaller/blob/main/recaller/documents/router.py): `recaller/documents/router.py`
- [Pattern extraction](https://github.com/skygod07/recaller/blob/main/recaller/documents/patterns.py): `recaller/documents/patterns.py`
- [Evidence agent](https://github.com/skygod07/recaller/blob/main/recaller/ai/hermes/adapter.py): `recaller/ai/hermes/adapter.py`
- [Evidence and confidence](https://github.com/skygod07/recaller/blob/main/recaller/extraction/adapters.py): `recaller/extraction/adapters.py`
- [Informant evidence](https://github.com/skygod07/recaller/blob/main/recaller/extraction/informant.py): `recaller/extraction/informant.py`

### Deterministic decision

- [Evidence reconciliation](https://github.com/skygod07/recaller/blob/main/recaller/reconciliation/reconcile.py): `recaller/reconciliation/reconcile.py`
- [Credit calculations](https://github.com/skygod07/recaller/blob/main/recaller/credit_engine/engine.py): `recaller/credit_engine/engine.py`
- [Policy evaluation](https://github.com/skygod07/recaller/blob/main/recaller/policy_engine/engine.py): `recaller/policy_engine/engine.py`
- [Underwriting pipeline](https://github.com/skygod07/recaller/blob/main/recaller/orchestrator/pipeline.py): `recaller/orchestrator/pipeline.py`
- [Credit memo](https://github.com/skygod07/recaller/blob/main/recaller/narration/memo.py): `recaller/narration/memo.py`

### Review and audit

- [Scenario solver](https://github.com/skygod07/recaller/blob/main/recaller/whatif/solver.py): `recaller/whatif/solver.py`
- [Audit ledger](https://github.com/skygod07/recaller/blob/main/recaller/core/audit.py): `recaller/core/audit.py`

### Other components

- **Loan officer**
- **Model provider**

## Connections

- Loan officer → Underwriting console: uses (evidence: `README.md`)
- Underwriting console → Console API client: requests (evidence: `README.md`)
- Console API client → HTTP API: calls backend (evidence: `README.md`)
- HTTP API → Underwriting service: delegates (evidence: `recaller/app/api.py`)
- Underwriting service → Application database: persists records (evidence: `recaller/app/service.py`)
- Underwriting service → Background jobs: runs background work (evidence: `recaller/app/service.py`)
- Underwriting service → Underwriting pipeline: runs underwriting (evidence: `recaller/app/service.py`)
- Underwriting service → Document reading: reads uploads (evidence: `recaller/app/service.py`)
- Document reading → Extraction routing: routes documents (evidence: `recaller/documents/router.py`)
- Extraction routing → Pattern extraction: extracts fields (evidence: `recaller/documents/router.py`)
- Extraction routing → Evidence agent: uses when enabled (evidence: `recaller/documents/router.py`)
- Model provider → Evidence agent: supplies model (evidence: `README.md`)
- Extraction routing → Evidence and confidence: returns extracted fields (evidence: `recaller/documents/router.py`)
- Underwriting pipeline → Evidence and confidence: extracts evidence (evidence: `recaller/orchestrator/pipeline.py`)
- Underwriting pipeline → Evidence reconciliation: reconciles evidence (evidence: `recaller/orchestrator/pipeline.py`)
- Underwriting pipeline → Credit calculations: computes metrics (evidence: `recaller/orchestrator/pipeline.py`)
- Underwriting pipeline → Policy evaluation: evaluates rules (evidence: `recaller/orchestrator/pipeline.py`)
- Underwriting pipeline → Credit memo: generates memo (evidence: `recaller/orchestrator/pipeline.py`)
- Underwriting pipeline → Scenario solver: solves scenarios (evidence: `recaller/orchestrator/pipeline.py`)
- Underwriting pipeline → Audit ledger: records stages (evidence: `recaller/orchestrator/pipeline.py`)
- Credit calculations → Informant evidence: uses attested evidence (evidence: `recaller/credit_engine/engine.py`)
