# abhiraj-bambhore/razor-revx architecture

> Architecture diagram of the GitHub repository abhiraj-bambhore/razor-revx, 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/abhiraj-bambhore/razor-revx
- Repository: https://github.com/abhiraj-bambhore/razor-revx

## Overview

Razor-RevX is a stateful revenue-recovery platform: Razorpay-shaped failures are detected and scored, routed to a specialist, reviewed for safety, and addressed through recovery actions with audit reporting. The README documents the hierarchical routing, reflection and compliance stages, three-tier scoring fallback, and voice/IVR capability. Source-index references support the implementation links shown; some UI and optional integrations are documented but their runtime wiring was not sampled.

Main entry points: [`src/agents/orchestrator.py`](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/orchestrator.py) (Workflow Orchestrator), [`src/data/schemas.py`](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/data/schemas.py) (Event Models), [`src/audit/audit_trail.py`](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/audit/audit_trail.py) (Append-Only Ledger), [`src/actions`](https://github.com/abhiraj-bambhore/razor-revx/tree/main/src/actions) (Recovery Actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Events &amp; Detection"]
  node_schemas["Event Models<br/>[schemas.py]"]
  node_payment_detect["Payment Detection"]
  node_checkout_detect["Checkout Detection"]
  node_subscription_detect["Subscription Detection"]
  node_receivable_detect["Receivables Aging"]
  node_simulator["Event Simulator<br/>[simulator.py]"]
end

subgraph group_intelligence["Risk Intelligence"]
  node_risk_scorer["Risk Scorer<br/>[risk_scorer.py]"]
  node_llm["Gemini &amp; Heuristics<br/>[llm.py]"]
  node_features["Feature Engineering"]
  node_ml_model["ML Fallback<br/>[risk_model.py]"]
end

subgraph group_agents["Agent Recovery"]
  node_orchestrator["Workflow Orchestrator<br/>[orchestrator.py]"]
  node_supervisor["Supervisor Routing<br/>[supervisor.py]"]
  node_payment_agent["Payment Recovery"]
  node_checkout_agent["Checkout Recovery"]
  node_subscription_agent["Subscription Recovery"]
  node_receivables_agent["Receivables Chaser"]
end

subgraph group_execution["Actions &amp; Compliance"]
  node_compliance["Compliance Gate"]
  node_actions["Recovery Actions"]
end

subgraph group_visibility["Audit &amp; Dashboard"]
  node_audit[("Append-Only Ledger<br/>[audit_trail.py]")]
  node_reports["Recovery Reports<br/>[recovery_report.py]"]
  node_dashboard["Recovery Dashboard<br/>[index.html]"]
end

node_razorpay(("Razorpay Events"))
node_operator(("Operator / Customer"))

node_razorpay -->|"sends event"| node_schemas
node_schemas -->|"classifies type"| node_payment_detect
node_schemas -->|"classifies type"| node_checkout_detect
node_schemas -->|"classifies type"| node_subscription_detect
node_schemas -->|"classifies type"| node_receivable_detect
node_payment_detect -->|"detects events"| node_orchestrator
node_checkout_detect -->|"detects events"| node_orchestrator
node_subscription_detect -->|"detects events"| node_orchestrator
node_receivable_detect -->|"detects events"| node_orchestrator
node_orchestrator -->|"requests scoring"| node_risk_scorer
node_risk_scorer -->|"tries scoring"| node_llm
node_risk_scorer -->|"falls back to"| node_ml_model
node_ml_model -->|"builds vectors"| node_features
node_orchestrator -->|"requests route"| node_supervisor
node_orchestrator -->|"dispatches"| node_payment_agent
node_orchestrator -->|"dispatches"| node_checkout_agent
node_orchestrator -->|"dispatches"| node_subscription_agent
node_orchestrator -->|"dispatches"| node_receivables_agent
node_orchestrator -->|"validates proposal"| node_compliance
node_orchestrator -->|"reflection reroute"| node_supervisor
node_payment_agent -->|"executes recovery"| node_actions
node_checkout_agent -->|"executes recovery"| node_actions
node_subscription_agent -->|"executes recovery"| node_actions
node_receivables_agent -->|"executes recovery"| node_actions
node_payment_agent -->|"records outcome"| node_audit
node_checkout_agent -->|"records outcome"| node_audit
node_subscription_agent -->|"records outcome"| node_audit
node_receivables_agent -->|"records outcome"| node_audit
node_compliance -->|"logs verdict"| node_audit
node_audit -->|"reads ledger"| node_reports
node_operator -->|"views telemetry"| node_dashboard
node_dashboard -.->|"invokes recovery"| node_orchestrator
node_simulator -->|"generates events"| node_schemas

click node_schemas "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/data/schemas.py"
click node_payment_detect "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/payment_detector.py"
click node_checkout_detect "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/checkout_detector.py"
click node_subscription_detect "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/subscription_detector.py"
click node_receivable_detect "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/receivables_detector.py"
click node_risk_scorer "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/risk_scorer.py"
click node_llm "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/utils/llm.py"
click node_features "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/ml/feature_engineering.py"
click node_ml_model "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/ml/risk_model.py"
click node_orchestrator "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/orchestrator.py"
click node_supervisor "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/supervisor.py"
click node_payment_agent "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/payment_recovery.py"
click node_checkout_agent "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/checkout_recovery.py"
click node_subscription_agent "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/subscription_recovery.py"
click node_receivables_agent "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/receivables_chaser.py"
click node_compliance "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/compliance_agent.py"
click node_actions "https://github.com/abhiraj-bambhore/razor-revx/tree/main/src/actions"
click node_audit "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/audit/audit_trail.py"
click node_reports "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/audit/recovery_report.py"
click node_dashboard "https://github.com/abhiraj-bambhore/razor-revx/blob/main/web/index.html"
click node_simulator "https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/data/simulator.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_schemas,node_payment_detect,node_checkout_detect,node_subscription_detect,node_receivable_detect,node_simulator toneBlue
class node_risk_scorer,node_llm,node_features,node_ml_model toneAmber
class node_orchestrator,node_supervisor,node_payment_agent,node_checkout_agent,node_subscription_agent,node_receivables_agent toneMint
class node_compliance,node_actions toneRose
class node_audit,node_reports,node_dashboard,node_razorpay,node_operator toneIndigo
```

## Components

### Events & Detection

- [Event Models](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/data/schemas.py): `src/data/schemas.py`
- [Payment Detection](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/payment_detector.py): `src/detection/payment_detector.py`
- [Checkout Detection](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/checkout_detector.py): `src/detection/checkout_detector.py`
- [Subscription Detection](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/subscription_detector.py): `src/detection/subscription_detector.py`
- [Receivables Aging](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/detection/receivables_detector.py): `src/detection/receivables_detector.py`
- [Event Simulator](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/data/simulator.py): `src/data/simulator.py`

### Risk Intelligence

- [Risk Scorer](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/risk_scorer.py): `src/agents/risk_scorer.py`
- [Gemini & Heuristics](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/utils/llm.py): `src/utils/llm.py`
- [Feature Engineering](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/ml/feature_engineering.py): `src/ml/feature_engineering.py`
- [ML Fallback](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/ml/risk_model.py): `src/ml/risk_model.py`

### Agent Recovery

- [Workflow Orchestrator](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/orchestrator.py): `src/agents/orchestrator.py`
- [Supervisor Routing](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/supervisor.py): `src/agents/supervisor.py`
- [Payment Recovery](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/payment_recovery.py): `src/agents/payment_recovery.py`
- [Checkout Recovery](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/checkout_recovery.py): `src/agents/checkout_recovery.py`
- [Subscription Recovery](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/subscription_recovery.py): `src/agents/subscription_recovery.py`
- [Receivables Chaser](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/receivables_chaser.py): `src/agents/receivables_chaser.py`

### Actions & Compliance

- [Compliance Gate](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/agents/compliance_agent.py): `src/agents/compliance_agent.py`
- [Recovery Actions](https://github.com/abhiraj-bambhore/razor-revx/tree/main/src/actions): `src/actions`

### Audit & Dashboard

- [Append-Only Ledger](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/audit/audit_trail.py): `src/audit/audit_trail.py`
- [Recovery Reports](https://github.com/abhiraj-bambhore/razor-revx/blob/main/src/audit/recovery_report.py): `src/audit/recovery_report.py`
- [Recovery Dashboard](https://github.com/abhiraj-bambhore/razor-revx/blob/main/web/index.html): `web/index.html`

### Other components

- **Razorpay Events**
- **Operator / Customer**

## Connections

- Razorpay Events → Event Models: sends event (evidence: `README.md`)
- Event Models → Payment Detection: classifies type (evidence: `src/detection/payment_detector.py`)
- Event Models → Checkout Detection: classifies type (evidence: `src/detection/checkout_detector.py`)
- Event Models → Subscription Detection: classifies type (evidence: `src/detection/subscription_detector.py`)
- Event Models → Receivables Aging: classifies type (evidence: `src/detection/receivables_detector.py`)
- Payment Detection → Workflow Orchestrator: detects events (evidence: `src/agents/orchestrator.py`)
- Checkout Detection → Workflow Orchestrator: detects events (evidence: `src/agents/orchestrator.py`)
- Subscription Detection → Workflow Orchestrator: detects events (evidence: `src/agents/orchestrator.py`)
- Receivables Aging → Workflow Orchestrator: detects events (evidence: `src/agents/orchestrator.py`)
- Workflow Orchestrator → Risk Scorer: requests scoring (evidence: `src/agents/orchestrator.py`)
- Risk Scorer → Gemini & Heuristics: tries scoring (evidence: `src/agents/risk_scorer.py`)
- Risk Scorer → ML Fallback: falls back to (evidence: `src/agents/risk_scorer.py`)
- ML Fallback → Feature Engineering: builds vectors (evidence: `src/ml/risk_model.py`)
- Workflow Orchestrator → Supervisor Routing: requests route (evidence: `src/agents/orchestrator.py`)
- Workflow Orchestrator → Payment Recovery: dispatches (evidence: `src/agents/orchestrator.py`)
- Workflow Orchestrator → Checkout Recovery: dispatches (evidence: `src/agents/orchestrator.py`)
- Workflow Orchestrator → Subscription Recovery: dispatches (evidence: `src/agents/orchestrator.py`)
- Workflow Orchestrator → Receivables Chaser: dispatches (evidence: `src/agents/orchestrator.py`)
- Workflow Orchestrator → Compliance Gate: validates proposal (evidence: `README.md`)
- Workflow Orchestrator → Supervisor Routing: reflection reroute (evidence: `README.md`)
- Payment Recovery → Recovery Actions: executes recovery (evidence: `src/agents/payment_recovery.py`)
- Checkout Recovery → Recovery Actions: executes recovery (evidence: `src/agents/checkout_recovery.py`)
- Subscription Recovery → Recovery Actions: executes recovery (evidence: `src/agents/subscription_recovery.py`)
- Receivables Chaser → Recovery Actions: executes recovery (evidence: `src/agents/receivables_chaser.py`)
- Payment Recovery → Append-Only Ledger: records outcome (evidence: `src/agents/payment_recovery.py`)
- Checkout Recovery → Append-Only Ledger: records outcome (evidence: `src/agents/checkout_recovery.py`)
- Subscription Recovery → Append-Only Ledger: records outcome (evidence: `src/agents/subscription_recovery.py`)
- Receivables Chaser → Append-Only Ledger: records outcome (evidence: `src/agents/receivables_chaser.py`)
- Compliance Gate → Append-Only Ledger: logs verdict (evidence: `src/agents/compliance_agent.py`)
- Append-Only Ledger → Recovery Reports: reads ledger (evidence: `src/audit/recovery_report.py`)
- Operator / Customer → Recovery Dashboard: views telemetry (evidence: `README.md`)
- Recovery Dashboard → Workflow Orchestrator: invokes recovery
- Event Simulator → Event Models: generates events (evidence: `src/data/simulator.py`)
