# bhavikk10/autharva_inbox_desk architecture

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

- Interactive diagram: https://gitdiagram.com/bhavikk10/autharva_inbox_desk
- Repository: https://github.com/bhavikk10/autharva_inbox_desk

## Overview

Inbox Desk is a read-only email attention and review application. A user browses or imports conversations, requests an assessment, then inspects its attention tier, obligation evidence, history, and editable reply drafts. The backend extracts and validates obligations, resolves dates, and applies attention policy before presenting results; saved runs and review corrections persist in SQLite. Gmail access and model providers are external integrations. Some subsystem links reflect README documentation or source-index references rather than inspected implementation details.

Main entry points: [`backend/main.py`](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/main.py) (FastAPI routes), [`frontend/src/App.tsx`](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/App.tsx) (Inbox workspace), [`frontend/src/api.ts`](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/api.ts) (API client), [`backend/service.py`](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/service.py) (Attention service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Inbox interface"]
  node_app["Inbox workspace<br/>[App.tsx]"]
  node_gmail_panel["Gmail controls<br/>[GmailPanel.tsx]"]
  node_review_tools["Review and drafts<br/>[ReviewTools.tsx]"]
  node_saved_runs["Saved runs<br/>[SavedRunsPanel.tsx]"]
  node_queue_panel["Analysis queue<br/>[QueuePanel.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Application API"]
  node_http_api["FastAPI routes<br/>[main.py]"]
end

subgraph group_analysis["Assessment pipeline"]
  node_analysis_service["Attention service<br/>[service.py]"]
  node_jobs["Analysis jobs<br/>[jobs.py]"]
  node_obligation_model["Obligation validation<br/>[domain.py]"]
  node_date_resolution["Date resolution<br/>[dates.py]"]
  node_attention_policy["Attention policy<br/>[policy.py]"]
  node_timezone_support["Timezone handling<br/>[timezones.py]"]
  node_draft_writer["Reply drafts<br/>[drafts.py]"]
  node_replay["Saved-run replay<br/>[replay.py]"]
end

subgraph group_persistence["Saved state"]
  node_sqlite_store[("Conversation and run store<br/>[store.py]")]
end

subgraph group_integrations["External integrations"]
  node_gmail_backend["Gmail import<br/>[gmail.py]"]
  node_model_providers["Model adapters<br/>[providers.py]"]
end

node_user(("Salesperson"))
node_gmail_service["Gmail API"]
node_model_service["Inference services"]

node_user -->|"uses"| node_app
node_app -->|"requests"| node_api_client
node_app -->|"opens"| node_gmail_panel
node_app -->|"shows"| node_review_tools
node_app -->|"shows"| node_saved_runs
node_app -->|"shows"| node_queue_panel
node_gmail_panel -->|"requests"| node_api_client
node_review_tools -->|"requests"| node_api_client
node_saved_runs -->|"requests"| node_api_client
node_queue_panel -->|"requests"| node_api_client
node_api_client -->|"calls API"| node_http_api
node_http_api -->|"routes analysis"| node_analysis_service
node_http_api -->|"creates jobs"| node_jobs
node_http_api -->|"routes Gmail"| node_gmail_backend
node_http_api -->|"configures drafts"| node_draft_writer
node_http_api -->|"imports runs"| node_replay
node_analysis_service -->|"reads and writes"| node_sqlite_store
node_analysis_service -->|"validates output"| node_obligation_model
node_analysis_service -->|"applies policy"| node_attention_policy
node_attention_policy -->|"resolves dates"| node_date_resolution
node_attention_policy -->|"uses zones"| node_timezone_support
node_analysis_service -->|"requests analysis"| node_model_providers
node_model_providers -->|"sends inference"| node_model_service
node_gmail_backend -->|"reads mail"| node_gmail_service
node_draft_writer -->|"uses provider"| node_model_providers
node_draft_writer -->|"uses contract"| node_obligation_model
node_replay -->|"loads saved runs"| node_sqlite_store
node_http_api -->|"seeds store"| node_sqlite_store

click node_app "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/App.tsx"
click node_gmail_panel "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/GmailPanel.tsx"
click node_review_tools "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/ReviewTools.tsx"
click node_saved_runs "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/SavedRunsPanel.tsx"
click node_queue_panel "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/QueuePanel.tsx"
click node_api_client "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/api.ts"
click node_http_api "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/main.py"
click node_analysis_service "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/service.py"
click node_jobs "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/jobs.py"
click node_obligation_model "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/domain.py"
click node_date_resolution "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/dates.py"
click node_attention_policy "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/policy.py"
click node_timezone_support "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/timezones.py"
click node_draft_writer "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/drafts.py"
click node_replay "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/replay.py"
click node_sqlite_store "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/store.py"
click node_gmail_backend "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/gmail.py"
click node_model_providers "https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/providers.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_app,node_gmail_panel,node_review_tools,node_saved_runs,node_queue_panel,node_api_client toneBlue
class node_http_api toneAmber
class node_analysis_service,node_jobs,node_obligation_model,node_date_resolution,node_attention_policy,node_timezone_support,node_draft_writer,node_replay,node_gmail_service toneMint
class node_sqlite_store toneRose
class node_gmail_backend,node_model_providers,node_user,node_model_service toneIndigo
```

## Components

### Inbox interface

- [Inbox workspace](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Gmail controls](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/GmailPanel.tsx): `frontend/src/GmailPanel.tsx`
- [Review and drafts](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/ReviewTools.tsx): `frontend/src/ReviewTools.tsx`
- [Saved runs](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/SavedRunsPanel.tsx): `frontend/src/SavedRunsPanel.tsx`
- [Analysis queue](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/QueuePanel.tsx): `frontend/src/QueuePanel.tsx`
- [API client](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/frontend/src/api.ts): `frontend/src/api.ts`

### Application API

- [FastAPI routes](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/main.py): `backend/main.py`

### Assessment pipeline

- [Attention service](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/service.py): `backend/service.py`
- [Analysis jobs](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/jobs.py): `backend/jobs.py`
- [Obligation validation](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/domain.py): `backend/domain.py`
- [Date resolution](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/dates.py): `backend/dates.py`
- [Attention policy](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/policy.py): `backend/policy.py`
- [Timezone handling](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/timezones.py): `backend/timezones.py`
- [Reply drafts](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/drafts.py): `backend/drafts.py`
- [Saved-run replay](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/replay.py): `backend/replay.py`

### Saved state

- [Conversation and run store](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/store.py): `backend/store.py`

### External integrations

- [Gmail import](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/gmail.py): `backend/gmail.py`
- [Model adapters](https://github.com/bhavikk10/autharva_inbox_desk/blob/main/backend/providers.py): `backend/providers.py`

### Other components

- **Salesperson**
- **Gmail API**
- **Inference services**

## Connections

- Salesperson → Inbox workspace: uses (evidence: `README.md`)
- Inbox workspace → API client: requests (evidence: `frontend/src/App.tsx`)
- Inbox workspace → Gmail controls: opens (evidence: `frontend/src/App.tsx`)
- Inbox workspace → Review and drafts: shows (evidence: `frontend/src/App.tsx`)
- Inbox workspace → Saved runs: shows (evidence: `frontend/src/App.tsx`)
- Inbox workspace → Analysis queue: shows (evidence: `frontend/src/App.tsx`)
- Gmail controls → API client: requests (evidence: `frontend/src/GmailPanel.tsx`)
- Review and drafts → API client: requests (evidence: `frontend/src/ReviewTools.tsx`)
- Saved runs → API client: requests (evidence: `frontend/src/SavedRunsPanel.tsx`)
- Analysis queue → API client: requests (evidence: `frontend/src/QueuePanel.tsx`)
- API client → FastAPI routes: calls API (evidence: `frontend/src/api.ts`)
- FastAPI routes → Attention service: routes analysis (evidence: `backend/main.py`)
- FastAPI routes → Analysis jobs: creates jobs (evidence: `backend/main.py`)
- FastAPI routes → Gmail import: routes Gmail (evidence: `backend/main.py`)
- FastAPI routes → Reply drafts: configures drafts (evidence: `backend/main.py`)
- FastAPI routes → Saved-run replay: imports runs (evidence: `backend/main.py`)
- Attention service → Conversation and run store: reads and writes (evidence: `backend/service.py`)
- Attention service → Obligation validation: validates output (evidence: `backend/service.py`)
- Attention service → Attention policy: applies policy (evidence: `backend/service.py`)
- Attention policy → Date resolution: resolves dates (evidence: `backend/policy.py`)
- Attention policy → Timezone handling: uses zones (evidence: `backend/policy.py`)
- Attention service → Model adapters: requests analysis (evidence: `backend/service.py`)
- Model adapters → Inference services: sends inference (evidence: `README.md`)
- Gmail import → Gmail API: reads mail (evidence: `README.md`)
- Reply drafts → Model adapters: uses provider (evidence: `backend/drafts.py`)
- Reply drafts → Obligation validation: uses contract (evidence: `backend/drafts.py`)
- Saved-run replay → Conversation and run store: loads saved runs (evidence: `backend/replay.py`)
- FastAPI routes → Conversation and run store: seeds store (evidence: `backend/main.py`)
