# billyjue/rea architecture

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

- Interactive diagram: https://gitdiagram.com/billyjue/rea
- Repository: https://github.com/billyjue/rea

## Overview

REA is a local reverse-engineering MCP server and CLI. The principal workflow is an agent or terminal user requesting an investigation; REA routes the target to an applicable analysis capability and returns findings with evidence and limitations. Capabilities span native and managed binaries, Android, JavaScript/Electron, websites, saved network captures, ELF diagnostics, EVM bytecode, and recorded crashes. The graph emphasizes the MCP startup and binary-provider path; README statements preserve major capabilities whose internal wiring was not sampled.

Main entry points: [`src/main.ts`](https://github.com/billyjue/rea/blob/main/src/main.ts) (MCP runtime), [`src/application/AnalysisProvider.ts`](https://github.com/billyjue/rea/blob/main/src/application/AnalysisProvider.ts) (Provider contract), [`src/application/binary/SessionProviderRouter.ts`](https://github.com/billyjue/rea/blob/main/src/application/binary/SessionProviderRouter.ts) (Provider routing), [`src/application/javascript/JavaScriptApplicationService.ts`](https://github.com/billyjue/rea/blob/main/src/application/javascript/JavaScriptApplicationService.ts) (JavaScript analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and routing"]
  node_runtime["MCP runtime<br/>[main.ts]"]
  node_session["Binary session<br/>[BinarySession.ts]"]
  node_routing["Provider routing"]
  node_analysis_provider["Provider contract"]
  node_results["Evidence and results<br/>[evidence.ts]"]
end

subgraph group_providers["Analysis providers"]
  node_ghidra["Ghidra client<br/>[GhidraClient.ts]"]
  node_hopper["Hopper client<br/>[HopperClient.ts]"]
  node_ida["IDA session"]
  node_android["Android analysis<br/>[JadxSession.ts]"]
end

subgraph group_applications["Application analysis"]
  node_js_analysis["JavaScript analysis"]
  node_js_workflows["Application workflows"]
  node_browser["Browser inspection<br/>[CdpConnection.ts]"]
  node_captures["Saved captures"]
  node_artifacts["Artifact inventory"]
end

subgraph group_diagnostics["Offline diagnostics"]
  node_elf["ELF diagnostics<br/>[layout_impl.py]"]
  node_evm["EVM analysis"]
  node_crashes["Recorded crashes"]
end

node_agent(("Agent / user"))

node_agent -->|"requests MCP"| node_runtime
node_runtime -->|"creates session"| node_session
node_runtime -.-> node_routing
node_routing -->|"routes operations"| node_analysis_provider
node_ghidra -->|"implements provider"| node_analysis_provider
node_hopper -->|"implements provider"| node_analysis_provider
node_ida -->|"implements provider"| node_analysis_provider
node_agent -.->|"requests analysis"| node_android
node_agent -->|"requests analysis"| node_js_analysis
node_js_analysis -->|"supports workflows"| node_js_workflows
node_agent -->|"requests inspection"| node_browser
node_agent -->|"requests capture analysis"| node_captures
node_agent -.->|"requests inventory"| node_artifacts
node_agent -->|"requests diagnostics"| node_elf
node_agent -->|"requests analysis"| node_evm
node_agent -->|"requests analysis"| node_crashes
node_runtime -->|"returns findings"| node_results

click node_runtime "https://github.com/billyjue/rea/blob/main/src/main.ts"
click node_session "https://github.com/billyjue/rea/blob/main/src/application/binary/BinarySession.ts"
click node_routing "https://github.com/billyjue/rea/blob/main/src/application/binary/SessionProviderRouter.ts"
click node_analysis_provider "https://github.com/billyjue/rea/blob/main/src/application/AnalysisProvider.ts"
click node_ghidra "https://github.com/billyjue/rea/blob/main/src/ghidra/GhidraClient.ts"
click node_hopper "https://github.com/billyjue/rea/blob/main/src/hopper/HopperClient.ts"
click node_ida "https://github.com/billyjue/rea/blob/main/src/ida/IdaSessionClient.ts"
click node_android "https://github.com/billyjue/rea/blob/main/src/android/JadxSession.ts"
click node_js_analysis "https://github.com/billyjue/rea/blob/main/src/application/javascript/JavaScriptApplicationService.ts"
click node_js_workflows "https://github.com/billyjue/rea/blob/main/src/application/javascript/JavaScriptApplicationWorkflowService.ts"
click node_browser "https://github.com/billyjue/rea/blob/main/src/browser/CdpConnection.ts"
click node_captures "https://github.com/billyjue/rea/blob/main/src/browser/history/HistoricalCaptureDecoder.ts"
click node_artifacts "https://github.com/billyjue/rea/blob/main/src/artifacts/inventory/ArtifactInventory.ts"
click node_elf "https://github.com/billyjue/rea/blob/main/bridge/pwntools/layout_impl.py"
click node_evm "https://github.com/billyjue/rea/blob/main/src/evm/EvmoleInterfaceWorker.ts"
click node_crashes "https://github.com/billyjue/rea/blob/main/bridge/pwntools/recorded_crash_impl.py"
click node_results "https://github.com/billyjue/rea/blob/main/src/domain/evidence.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_runtime,node_session,node_routing,node_analysis_provider,node_results,node_agent toneBlue
class node_ghidra,node_hopper,node_ida,node_android toneAmber
class node_js_analysis,node_js_workflows,node_browser,node_captures,node_artifacts toneMint
class node_elf,node_evm,node_crashes toneRose
```

## Components

### Runtime and routing

- [MCP runtime](https://github.com/billyjue/rea/blob/main/src/main.ts): `src/main.ts`
- [Binary session](https://github.com/billyjue/rea/blob/main/src/application/binary/BinarySession.ts): `src/application/binary/BinarySession.ts`
- [Provider routing](https://github.com/billyjue/rea/blob/main/src/application/binary/SessionProviderRouter.ts): `src/application/binary/SessionProviderRouter.ts`
- [Provider contract](https://github.com/billyjue/rea/blob/main/src/application/AnalysisProvider.ts): `src/application/AnalysisProvider.ts`
- [Evidence and results](https://github.com/billyjue/rea/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`

### Analysis providers

- [Ghidra client](https://github.com/billyjue/rea/blob/main/src/ghidra/GhidraClient.ts): `src/ghidra/GhidraClient.ts`
- [Hopper client](https://github.com/billyjue/rea/blob/main/src/hopper/HopperClient.ts): `src/hopper/HopperClient.ts`
- [IDA session](https://github.com/billyjue/rea/blob/main/src/ida/IdaSessionClient.ts): `src/ida/IdaSessionClient.ts`
- [Android analysis](https://github.com/billyjue/rea/blob/main/src/android/JadxSession.ts): `src/android/JadxSession.ts`

### Application analysis

- [JavaScript analysis](https://github.com/billyjue/rea/blob/main/src/application/javascript/JavaScriptApplicationService.ts): `src/application/javascript/JavaScriptApplicationService.ts`
- [Application workflows](https://github.com/billyjue/rea/blob/main/src/application/javascript/JavaScriptApplicationWorkflowService.ts): `src/application/javascript/JavaScriptApplicationWorkflowService.ts`
- [Browser inspection](https://github.com/billyjue/rea/blob/main/src/browser/CdpConnection.ts): `src/browser/CdpConnection.ts`
- [Saved captures](https://github.com/billyjue/rea/blob/main/src/browser/history/HistoricalCaptureDecoder.ts): `src/browser/history/HistoricalCaptureDecoder.ts`
- [Artifact inventory](https://github.com/billyjue/rea/blob/main/src/artifacts/inventory/ArtifactInventory.ts): `src/artifacts/inventory/ArtifactInventory.ts`

### Offline diagnostics

- [ELF diagnostics](https://github.com/billyjue/rea/blob/main/bridge/pwntools/layout_impl.py): `bridge/pwntools/layout_impl.py`
- [EVM analysis](https://github.com/billyjue/rea/blob/main/src/evm/EvmoleInterfaceWorker.ts): `src/evm/EvmoleInterfaceWorker.ts`
- [Recorded crashes](https://github.com/billyjue/rea/blob/main/bridge/pwntools/recorded_crash_impl.py): `bridge/pwntools/recorded_crash_impl.py`

### Other components

- **Agent / user**

## Connections

- Agent / user → MCP runtime: requests MCP (evidence: `README.md`)
- MCP runtime → Binary session: creates session (evidence: `src/main.ts`)
- MCP runtime → Provider routing
- Provider routing → Provider contract: routes operations (evidence: `src/application/binary/SessionProviderRouter.ts`)
- Ghidra client → Provider contract: implements provider (evidence: `src/ghidra/GhidraProviderClient.ts`)
- Hopper client → Provider contract: implements provider (evidence: `src/hopper/HopperClient.ts`)
- IDA session → Provider contract: implements provider (evidence: `src/ida/IdaSessionClient.ts`)
- Agent / user → Android analysis: requests analysis
- Agent / user → JavaScript analysis: requests analysis (evidence: `README.md`)
- JavaScript analysis → Application workflows: supports workflows (evidence: `src/application/javascript/JavaScriptApplicationWorkflowService.ts`)
- Agent / user → Browser inspection: requests inspection (evidence: `README.md`)
- Agent / user → Saved captures: requests capture analysis (evidence: `README.md`)
- Agent / user → Artifact inventory: requests inventory
- Agent / user → ELF diagnostics: requests diagnostics (evidence: `README.md`)
- Agent / user → EVM analysis: requests analysis (evidence: `README.md`)
- Agent / user → Recorded crashes: requests analysis (evidence: `README.md`)
- MCP runtime → Evidence and results: returns findings (evidence: `README.md`)
