# jungyunseong/rea architecture

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

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

## Overview

REA is a local reverse-engineering MCP server and CLI. An agent or terminal user selects a target and requests an investigation; REA routes work to a suitable analyzer and returns findings with evidence and limitations. The README documents multiple target-specific capabilities, while the source index confirms the main server, provider, browser, JavaScript, and analysis layers. Several capability implementations are represented by their exact source paths, but unsampled internal dispatch links are omitted or identified as documented rather than inferred.

Main entry points: [`src/main.ts`](https://github.com/jungyunseong/rea/blob/main/src/main.ts) (REA entrypoint), [`src/application/AnalysisProvider.ts`](https://github.com/jungyunseong/rea/blob/main/src/application/AnalysisProvider.ts) (Provider contract), [`src/server/contractToolHandler.ts`](https://github.com/jungyunseong/rea/blob/main/src/server/contractToolHandler.ts) (MCP tool handler), [`src/application/binary/SessionProviderRouter.ts`](https://github.com/jungyunseong/rea/blob/main/src/application/binary/SessionProviderRouter.ts) (Session provider router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and tools"]
  node_entry["REA entrypoint<br/>[main.ts]"]
  node_toolhandler["MCP tool handler"]
  node_provider["Provider contract"]
  node_sessionrouter["Session provider router"]
end

subgraph group_binary["Binary analysis"]
  node_nativeproviders["Native analyzers"]
  node_hopper["Hopper analyzer<br/>[HopperClient.ts]"]
  node_ida["IDA analyzer"]
  node_elf["ELF diagnostics"]
  node_go["Go inspection<br/>[GoBinaryService.ts]"]
  node_wasm["WASM inspection"]
  node_evm["EVM inspection"]
end

subgraph group_application["Application analysis"]
  node_javascript["JavaScript analysis"]
  node_worker["Analysis worker"]
  node_android["Android analysis"]
  node_managed[".NET analysis"]
  node_sqlite["SQLite inspection"]
end

subgraph group_web["Web and runtime"]
  node_browser["Browser inspection"]
  node_cdp[("Browser capture storage")]
end

subgraph group_evidence["Evidence and results"]
  node_evidence["Evidence records<br/>[evidence.ts]"]
  node_coverage["Reconstruction coverage"]
  node_result["Typed results<br/>[result.ts]"]
end

node_agent(("Agent"))
node_terminal(("Terminal user"))

node_agent -->|"requests analysis"| node_entry
node_terminal -->|"runs workflows"| node_entry
node_entry -->|"starts MCP"| node_toolhandler
node_entry -->|"creates binary session"| node_sessionrouter
node_toolhandler -->|"invokes analysis"| node_provider
node_sessionrouter -->|"routes operations"| node_provider
node_provider -->|"analyzes binaries"| node_nativeproviders
node_provider -->|"analyzes binaries"| node_hopper
node_provider -->|"analyzes binaries"| node_ida
node_entry -.->|"offers ELF diagnostics"| node_elf
node_entry -.->|"offers Go inspection"| node_go
node_entry -.->|"offers WASM inspection"| node_wasm
node_entry -.->|"offers EVM inspection"| node_evm
node_entry -.->|"offers app analysis"| node_javascript
node_javascript -->|"analyzes modules"| node_worker
node_entry -.->|"offers Android analysis"| node_android
node_entry -.->|"offers .NET analysis"| node_managed
node_entry -.->|"offers website inspection"| node_browser
node_browser -->|"captures observations"| node_cdp
node_entry -.->|"offers database inspection"| node_sqlite
node_toolhandler -->|"returns findings"| node_evidence
node_toolhandler -->|"returns outcomes"| node_result
node_entry -.->|"offers coverage evaluation"| node_coverage

click node_entry "https://github.com/jungyunseong/rea/blob/main/src/main.ts"
click node_toolhandler "https://github.com/jungyunseong/rea/blob/main/src/server/contractToolHandler.ts"
click node_provider "https://github.com/jungyunseong/rea/blob/main/src/application/AnalysisProvider.ts"
click node_sessionrouter "https://github.com/jungyunseong/rea/blob/main/src/application/binary/SessionProviderRouter.ts"
click node_nativeproviders "https://github.com/jungyunseong/rea/blob/main/src/ghidra/GhidraProviderClient.ts"
click node_hopper "https://github.com/jungyunseong/rea/blob/main/src/hopper/HopperClient.ts"
click node_ida "https://github.com/jungyunseong/rea/blob/main/src/ida/IdaSessionClient.ts"
click node_elf "https://github.com/jungyunseong/rea/blob/main/src/application/binaryDiagnostics/BinaryLayoutService.ts"
click node_go "https://github.com/jungyunseong/rea/blob/main/src/application/go/GoBinaryService.ts"
click node_wasm "https://github.com/jungyunseong/rea/blob/main/src/application/wasm/WasmInterfaceComparisonService.ts"
click node_evm "https://github.com/jungyunseong/rea/blob/main/src/application/evm/EvmInterfaceService.ts"
click node_javascript "https://github.com/jungyunseong/rea/blob/main/src/application/javascript/JavaScriptApplicationService.ts"
click node_worker "https://github.com/jungyunseong/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts"
click node_android "https://github.com/jungyunseong/rea/blob/main/src/application/android/AndroidAnalysisService.ts"
click node_managed "https://github.com/jungyunseong/rea/blob/main/src/application/AnalysisProvider.ts"
click node_browser "https://github.com/jungyunseong/rea/blob/main/src/application/BrowserObservationService.ts"
click node_cdp "https://github.com/jungyunseong/rea/blob/main/src/browser/CdpCaptureStorage.ts"
click node_sqlite "https://github.com/jungyunseong/rea/blob/main/src/sqlite/SqliteDatabaseInspection.ts"
click node_evidence "https://github.com/jungyunseong/rea/blob/main/src/domain/evidence.ts"
click node_coverage "https://github.com/jungyunseong/rea/blob/main/src/application/ReconstructionCoverageService.ts"
click node_result "https://github.com/jungyunseong/rea/blob/main/src/domain/result.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_entry,node_toolhandler,node_provider,node_sessionrouter,node_terminal toneBlue
class node_nativeproviders,node_hopper,node_ida,node_elf,node_go,node_wasm,node_evm toneAmber
class node_javascript,node_worker,node_android,node_managed,node_sqlite toneMint
class node_browser,node_cdp toneRose
class node_evidence,node_coverage,node_result,node_agent toneIndigo
```

## Components

### Runtime and tools

- [REA entrypoint](https://github.com/jungyunseong/rea/blob/main/src/main.ts): `src/main.ts`
- [MCP tool handler](https://github.com/jungyunseong/rea/blob/main/src/server/contractToolHandler.ts): `src/server/contractToolHandler.ts`
- [Provider contract](https://github.com/jungyunseong/rea/blob/main/src/application/AnalysisProvider.ts): `src/application/AnalysisProvider.ts`
- [Session provider router](https://github.com/jungyunseong/rea/blob/main/src/application/binary/SessionProviderRouter.ts): `src/application/binary/SessionProviderRouter.ts`

### Binary analysis

- [Native analyzers](https://github.com/jungyunseong/rea/blob/main/src/ghidra/GhidraProviderClient.ts): `src/ghidra/GhidraProviderClient.ts`
- [Hopper analyzer](https://github.com/jungyunseong/rea/blob/main/src/hopper/HopperClient.ts): `src/hopper/HopperClient.ts`
- [IDA analyzer](https://github.com/jungyunseong/rea/blob/main/src/ida/IdaSessionClient.ts): `src/ida/IdaSessionClient.ts`
- [ELF diagnostics](https://github.com/jungyunseong/rea/blob/main/src/application/binaryDiagnostics/BinaryLayoutService.ts): `src/application/binaryDiagnostics/BinaryLayoutService.ts`
- [Go inspection](https://github.com/jungyunseong/rea/blob/main/src/application/go/GoBinaryService.ts): `src/application/go/GoBinaryService.ts`
- [WASM inspection](https://github.com/jungyunseong/rea/blob/main/src/application/wasm/WasmInterfaceComparisonService.ts): `src/application/wasm/WasmInterfaceComparisonService.ts`
- [EVM inspection](https://github.com/jungyunseong/rea/blob/main/src/application/evm/EvmInterfaceService.ts): `src/application/evm/EvmInterfaceService.ts`

### Application analysis

- [JavaScript analysis](https://github.com/jungyunseong/rea/blob/main/src/application/javascript/JavaScriptApplicationService.ts): `src/application/javascript/JavaScriptApplicationService.ts`
- [Analysis worker](https://github.com/jungyunseong/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts): `src/javascript/analysis/JavaScriptAnalysisWorker.ts`
- [Android analysis](https://github.com/jungyunseong/rea/blob/main/src/application/android/AndroidAnalysisService.ts): `src/application/android/AndroidAnalysisService.ts`
- [.NET analysis](https://github.com/jungyunseong/rea/blob/main/src/application/AnalysisProvider.ts): `src/application/AnalysisProvider.ts`
- [SQLite inspection](https://github.com/jungyunseong/rea/blob/main/src/sqlite/SqliteDatabaseInspection.ts): `src/sqlite/SqliteDatabaseInspection.ts`

### Web and runtime

- [Browser inspection](https://github.com/jungyunseong/rea/blob/main/src/application/BrowserObservationService.ts): `src/application/BrowserObservationService.ts`
- [Browser capture storage](https://github.com/jungyunseong/rea/blob/main/src/browser/CdpCaptureStorage.ts): `src/browser/CdpCaptureStorage.ts`

### Evidence and results

- [Evidence records](https://github.com/jungyunseong/rea/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`
- [Reconstruction coverage](https://github.com/jungyunseong/rea/blob/main/src/application/ReconstructionCoverageService.ts): `src/application/ReconstructionCoverageService.ts`
- [Typed results](https://github.com/jungyunseong/rea/blob/main/src/domain/result.ts): `src/domain/result.ts`

### Other components

- **Agent**
- **Terminal user**

## Connections

- Agent → REA entrypoint: requests analysis
- Terminal user → REA entrypoint: runs workflows
- REA entrypoint → MCP tool handler: starts MCP (evidence: `src/main.ts`)
- REA entrypoint → Session provider router: creates binary session (evidence: `src/main.ts`)
- MCP tool handler → Provider contract: invokes analysis (evidence: `src/server/contractToolHandler.ts`)
- Session provider router → Provider contract: routes operations (evidence: `src/application/binary/SessionProviderRouter.ts`)
- Provider contract → Native analyzers: analyzes binaries (evidence: `src/ghidra/GhidraProviderClient.ts`)
- Provider contract → Hopper analyzer: analyzes binaries (evidence: `src/hopper/HopperClient.ts`)
- Provider contract → IDA analyzer: analyzes binaries (evidence: `src/ida/IdaSessionClient.ts`)
- REA entrypoint → ELF diagnostics: offers ELF diagnostics
- REA entrypoint → Go inspection: offers Go inspection
- REA entrypoint → WASM inspection: offers WASM inspection
- REA entrypoint → EVM inspection: offers EVM inspection
- REA entrypoint → JavaScript analysis: offers app analysis
- JavaScript analysis → Analysis worker: analyzes modules
- REA entrypoint → Android analysis: offers Android analysis
- REA entrypoint → .NET analysis: offers .NET analysis
- REA entrypoint → Browser inspection: offers website inspection
- Browser inspection → Browser capture storage: captures observations
- REA entrypoint → SQLite inspection: offers database inspection
- MCP tool handler → Evidence records: returns findings (evidence: `src/server/contractToolHandler.ts`)
- MCP tool handler → Typed results: returns outcomes (evidence: `src/server/contractToolHandler.ts`)
- REA entrypoint → Reconstruction coverage: offers coverage evaluation
