# yogi-ya/callscreener architecture

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

- Interactive diagram: https://gitdiagram.com/yogi-ya/callscreener
- Repository: https://github.com/yogi-ya/callscreener

## Overview

AegisCall is an Android call-screening product with a React/Capacitor control interface and Node backend. A real incoming call enters Android Telecom, receives a cloud or local verdict under a deadline, and is acted on by the OS; UI events, logs, rules, and dashboard/simulator flows form supporting branches. The README documents capabilities beyond sampled code, including transcript-driven screening and Gemini analysis; those edges are included only where documented. Unsampled UI subsystems use exact component paths from the tree.

Main entry points: [`frontend/src/App.tsx`](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/App.tsx) (App navigation), [`android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt`](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt) (Deadline screener), [`backend/src/routes/screeningRoutes.ts`](https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/screeningRoutes.ts) (Screening routes), [`frontend/src/services/api.ts`](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/services/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android call runtime"]
  node_screening_service["Deadline screener"]
  node_local_rules["Local rule engine"]
  node_ondevice_llm["On-device LLM"]
  node_in_call["In-call controls"]
  node_voice_engine["Voice screening"]
  node_native_bridge["Capacitor native bridge"]
end

subgraph group_backend["Screening backend"]
  node_backend_api["Screening routes<br/>[screeningRoutes.ts]"]
  node_cloud_engine["Cloud screening engine"]
  node_fast_rules["Backend fast rules<br/>[fastRulesEngine.ts]"]
  node_server["Backend server<br/>[server.ts]"]
  node_health["Health endpoint<br/>[healthRoutes.ts]"]
  node_log_routes["Log endpoints<br/>[logRoutes.ts]"]
end

subgraph group_frontend["Mobile web interface"]
  node_ui["App navigation<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_capacitor_client["Capacitor client"]
  node_dashboard["Dashboard and risk<br/>[DashboardTab.tsx]"]
  node_call_logs["Call logs<br/>[CallLogsTab.tsx]"]
  node_rules_ui["Rules manager<br/>[RulesTab.tsx]"]
  node_settings["Setup and settings<br/>[SettingsTab.tsx]"]
  node_setup_wizard["Permission wizard"]
  node_simulator["Call simulator<br/>[SimulatorTab.tsx]"]
  node_dialer["Dialer and overlay<br/>[DialerTab.tsx]"]
end

subgraph group_storage["Rules and history"]
  node_history_native[("Native call history")]
  node_backend_logs[("Backend call logs<br/>[callLogStorage.ts]")]
end

node_caller(("Incoming caller"))
node_telecom["Android Telecom"]
node_llm_provider["Cloud LLM provider"]
node_verdict["Screening verdict"]

node_caller -->|"places call"| node_telecom
node_telecom -->|"dispatches call"| node_screening_service
node_screening_service -->|"requests screening"| node_backend_api
node_screening_service -->|"falls back"| node_local_rules
node_screening_service -->|"uses fallback"| node_ondevice_llm
node_backend_api -->|"screens payload"| node_cloud_engine
node_cloud_engine -->|"checks rules"| node_fast_rules
node_cloud_engine -.->|"analyzes call"| node_llm_provider
node_backend_api -->|"stores result"| node_backend_logs
node_screening_service -.->|"returns verdict"| node_telecom
node_screening_service -->|"records screening"| node_history_native
node_telecom -->|"adds active call"| node_in_call
node_in_call -->|"starts conversation"| node_voice_engine
node_voice_engine -->|"broadcasts speech"| node_native_bridge
node_in_call -->|"broadcasts call events"| node_native_bridge
node_native_bridge -->|"emits call events"| node_capacitor_client
node_ui -->|"subscribes events"| node_capacitor_client
node_ui -->|"requests screening"| node_api_client
node_api_client -->|"posts call data"| node_backend_api
node_ui -->|"renders view"| node_dashboard
node_ui -->|"renders view"| node_call_logs
node_ui -->|"renders view"| node_rules_ui
node_ui -->|"renders view"| node_settings
node_ui -->|"renders wizard"| node_setup_wizard
node_ui -.->|"renders view"| node_simulator
node_ui -->|"renders view"| node_dialer
node_dashboard -.->|"reads stats"| node_api_client
node_call_logs -.->|"reads call history"| node_api_client
node_rules_ui -.->|"manages rules"| node_api_client
node_settings -->|"requests roles"| node_capacitor_client
node_setup_wizard -->|"checks permissions"| node_capacitor_client
node_setup_wizard -->|"checks backend"| node_api_client
node_dialer -->|"uses native calls"| node_capacitor_client
node_server -->|"registers routes"| node_backend_api
node_server -->|"registers routes"| node_health
node_server -->|"registers routes"| node_log_routes
node_log_routes -->|"reads history"| node_backend_logs
node_backend_api -->|"serves rule edits"| node_fast_rules

click node_screening_service "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt"
click node_local_rules "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/FastLocalRulesEngine.kt"
click node_ondevice_llm "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/OnDeviceLlmEngine.kt"
click node_backend_api "https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/screeningRoutes.ts"
click node_cloud_engine "https://github.com/yogi-ya/callscreener/blob/main/backend/src/services/llmScreeningEngine.ts"
click node_fast_rules "https://github.com/yogi-ya/callscreener/blob/main/backend/src/services/fastRulesEngine.ts"
click node_in_call "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AegisInCallService.kt"
click node_voice_engine "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AiVoiceScreeningEngine.kt"
click node_history_native "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/CallHistoryStorage.kt"
click node_native_bridge "https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/plugins/CallScreeningPlugin.kt"
click node_ui "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/services/api.ts"
click node_capacitor_client "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/services/capacitorService.ts"
click node_dashboard "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/DashboardTab.tsx"
click node_call_logs "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/CallLogsTab.tsx"
click node_rules_ui "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/RulesTab.tsx"
click node_settings "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/SettingsTab.tsx"
click node_setup_wizard "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/AutoSetupWizard.tsx"
click node_simulator "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/SimulatorTab.tsx"
click node_dialer "https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/DialerTab.tsx"
click node_backend_logs "https://github.com/yogi-ya/callscreener/blob/main/backend/src/services/callLogStorage.ts"
click node_server "https://github.com/yogi-ya/callscreener/blob/main/backend/src/server.ts"
click node_health "https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/healthRoutes.ts"
click node_log_routes "https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/logRoutes.ts"

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_screening_service,node_local_rules,node_ondevice_llm,node_in_call,node_voice_engine,node_native_bridge,node_verdict toneBlue
class node_backend_api,node_cloud_engine,node_fast_rules,node_server,node_health,node_log_routes toneAmber
class node_ui,node_api_client,node_capacitor_client,node_dashboard,node_call_logs,node_rules_ui,node_settings,node_setup_wizard,node_simulator,node_dialer toneMint
class node_history_native,node_backend_logs toneRose
class node_caller,node_telecom,node_llm_provider toneIndigo
```

## Components

### Android call runtime

- [Deadline screener](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt): `android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt`
- [Local rule engine](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/FastLocalRulesEngine.kt): `android/app/src/main/java/com/aegiscall/screener/telecom/FastLocalRulesEngine.kt`
- [On-device LLM](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/OnDeviceLlmEngine.kt): `android/app/src/main/java/com/aegiscall/screener/telecom/OnDeviceLlmEngine.kt`
- [In-call controls](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AegisInCallService.kt): `android/app/src/main/java/com/aegiscall/screener/telecom/AegisInCallService.kt`
- [Voice screening](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/AiVoiceScreeningEngine.kt): `android/app/src/main/java/com/aegiscall/screener/telecom/AiVoiceScreeningEngine.kt`
- [Capacitor native bridge](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/plugins/CallScreeningPlugin.kt): `android/app/src/main/java/com/aegiscall/screener/plugins/CallScreeningPlugin.kt`

### Screening backend

- [Screening routes](https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/screeningRoutes.ts): `backend/src/routes/screeningRoutes.ts`
- [Cloud screening engine](https://github.com/yogi-ya/callscreener/blob/main/backend/src/services/llmScreeningEngine.ts): `backend/src/services/llmScreeningEngine.ts`
- [Backend fast rules](https://github.com/yogi-ya/callscreener/blob/main/backend/src/services/fastRulesEngine.ts): `backend/src/services/fastRulesEngine.ts`
- [Backend server](https://github.com/yogi-ya/callscreener/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Health endpoint](https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/healthRoutes.ts): `backend/src/routes/healthRoutes.ts`
- [Log endpoints](https://github.com/yogi-ya/callscreener/blob/main/backend/src/routes/logRoutes.ts): `backend/src/routes/logRoutes.ts`

### Mobile web interface

- [App navigation](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Capacitor client](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/services/capacitorService.ts): `frontend/src/services/capacitorService.ts`
- [Dashboard and risk](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/DashboardTab.tsx): `frontend/src/components/DashboardTab.tsx`
- [Call logs](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/CallLogsTab.tsx): `frontend/src/components/CallLogsTab.tsx`
- [Rules manager](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/RulesTab.tsx): `frontend/src/components/RulesTab.tsx`
- [Setup and settings](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/SettingsTab.tsx): `frontend/src/components/SettingsTab.tsx`
- [Permission wizard](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/AutoSetupWizard.tsx): `frontend/src/components/AutoSetupWizard.tsx`
- [Call simulator](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/SimulatorTab.tsx): `frontend/src/components/SimulatorTab.tsx`
- [Dialer and overlay](https://github.com/yogi-ya/callscreener/blob/main/frontend/src/components/DialerTab.tsx): `frontend/src/components/DialerTab.tsx`

### Rules and history

- [Native call history](https://github.com/yogi-ya/callscreener/blob/main/android/app/src/main/java/com/aegiscall/screener/telecom/CallHistoryStorage.kt): `android/app/src/main/java/com/aegiscall/screener/telecom/CallHistoryStorage.kt`
- [Backend call logs](https://github.com/yogi-ya/callscreener/blob/main/backend/src/services/callLogStorage.ts): `backend/src/services/callLogStorage.ts`

### Other components

- **Incoming caller**
- **Android Telecom**
- **Cloud LLM provider**
- **Screening verdict**

## Connections

- Incoming caller → Android Telecom: places call
- Android Telecom → Deadline screener: dispatches call
- Deadline screener → Screening routes: requests screening
- Deadline screener → Local rule engine: falls back (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt`)
- Deadline screener → On-device LLM: uses fallback (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt`)
- Screening routes → Cloud screening engine: screens payload (evidence: `backend/src/routes/screeningRoutes.ts`)
- Cloud screening engine → Backend fast rules: checks rules (evidence: `backend/src/services/llmScreeningEngine.ts`)
- Cloud screening engine → Cloud LLM provider: analyzes call
- Screening routes → Backend call logs: stores result (evidence: `backend/src/routes/screeningRoutes.ts`)
- Deadline screener → Android Telecom: returns verdict
- Deadline screener → Native call history: records screening (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AiCallScreeningService.kt`)
- Android Telecom → In-call controls: adds active call (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AegisInCallService.kt`)
- In-call controls → Voice screening: starts conversation (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AegisInCallService.kt`)
- Voice screening → Capacitor native bridge: broadcasts speech (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AiVoiceScreeningEngine.kt`)
- In-call controls → Capacitor native bridge: broadcasts call events (evidence: `android/app/src/main/java/com/aegiscall/screener/telecom/AegisInCallService.kt`)
- Capacitor native bridge → Capacitor client: emits call events (evidence: `android/app/src/main/java/com/aegiscall/screener/plugins/CallScreeningPlugin.kt`)
- App navigation → Capacitor client: subscribes events (evidence: `frontend/src/App.tsx`)
- App navigation → API client: requests screening (evidence: `frontend/src/App.tsx`)
- API client → Screening routes: posts call data (evidence: `frontend/src/services/api.ts`)
- App navigation → Dashboard and risk: renders view (evidence: `frontend/src/App.tsx`)
- App navigation → Call logs: renders view (evidence: `frontend/src/App.tsx`)
- App navigation → Rules manager: renders view (evidence: `frontend/src/App.tsx`)
- App navigation → Setup and settings: renders view (evidence: `frontend/src/App.tsx`)
- App navigation → Permission wizard: renders wizard (evidence: `frontend/src/App.tsx`)
- App navigation → Call simulator: renders view
- App navigation → Dialer and overlay: renders view (evidence: `frontend/src/App.tsx`)
- Dashboard and risk → API client: reads stats
- Call logs → API client: reads call history
- Rules manager → API client: manages rules
- Setup and settings → Capacitor client: requests roles (evidence: `frontend/src/services/capacitorService.ts`)
- Permission wizard → Capacitor client: checks permissions (evidence: `frontend/src/components/AutoSetupWizard.tsx`)
- Permission wizard → API client: checks backend (evidence: `frontend/src/components/AutoSetupWizard.tsx`)
- Dialer and overlay → Capacitor client: uses native calls (evidence: `frontend/src/components/DialerTab.tsx`)
- Backend server → Screening routes: registers routes (evidence: `backend/src/server.ts`)
- Backend server → Health endpoint: registers routes (evidence: `backend/src/server.ts`)
- Backend server → Log endpoints: registers routes (evidence: `backend/src/server.ts`)
- Log endpoints → Backend call logs: reads history (evidence: `backend/src/routes/logRoutes.ts`)
- Screening routes → Backend fast rules: serves rule edits (evidence: `backend/src/routes/screeningRoutes.ts`)
