# sgunin/reverseengineeranything architecture

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

- Interactive diagram: https://gitdiagram.com/sgunin/reverseengineeranything
- Repository: https://github.com/sgunin/reverseengineeranything

## Overview

REA is a local reverse-engineering toolkit exposed through an agent-facing MCP server and a CLI. Its principal workflow is to select an analysis provider, inspect an application or binary, and present evidence and limitations that help an engineer understand and recreate behavior. The README also describes setup and support for native, JavaScript/Electron, .NET, and web investigations. Some provider and domain internals are unsampled, so their connections are shown only where the README or source index supports them.

Main entry points: [`src/main.ts`](https://github.com/sgunin/reverseengineeranything/blob/main/src/main.ts) (MCP server), [`src/application/AnalysisProvider.ts`](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/AnalysisProvider.ts) (Analysis provider), [`src/browser/CdpConnection.ts`](https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpConnection.ts) (CDP connection), [`src/application/SessionProviderRouter.ts`](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/SessionProviderRouter.ts) (Provider router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_mcp["MCP server<br/>[main.ts]"]
  node_cli["CLI<br/>[cli.ts]"]
end

subgraph group_coordination["Analysis coordination"]
  node_session["Binary session<br/>[BinarySession.ts]"]
  node_router["Provider router"]
  node_analysis["Analysis provider"]
end

subgraph group_providers["Analysis providers"]
  node_hopper["Hopper bridge<br/>[HopperClient.ts]"]
  node_ghidra["Ghidra bridge<br/>[GhidraClient.ts]"]
  node_native["Native analysis"]
  node_managed[".NET analysis"]
end

subgraph group_web["Web observation"]
  node_browserprovider["CDP provider"]
  node_cdpconnection["CDP connection<br/>[CdpConnection.ts]"]
  node_capture["Capture handlers"]
  node_storage["Storage capture"]
end

subgraph group_models["Analysis models"]
  node_javascript["JavaScript analysis"]
  node_semantic["Semantic graph"]
  node_semanticquery["Graph query"]
  node_coverage["Reconstruction coverage"]
end

node_agent(("AI agent"))
node_engineer(("Engineer"))

node_agent -->|"uses tools"| node_mcp
node_engineer -->|"runs analysis"| node_cli
node_mcp -->|"creates session"| node_session
node_mcp -->|"starts transport"| node_router
node_router -->|"selects provider"| node_analysis
node_analysis -.->|"uses provider"| node_hopper
node_analysis -.->|"uses provider"| node_ghidra
node_engineer -->|"investigates binaries"| node_native
node_engineer -->|"investigates assemblies"| node_managed
node_engineer -->|"investigates apps"| node_javascript
node_javascript -->|"builds graph"| node_semantic
node_semantic -->|"queried by"| node_semanticquery
node_engineer -->|"investigates websites"| node_browserprovider
node_browserprovider -.->|"uses connection"| node_cdpconnection
node_capture -->|"issues commands"| node_cdpconnection
node_storage -->|"issues commands"| node_cdpconnection
node_engineer -.->|"checks reconstruction"| node_coverage

click node_mcp "https://github.com/sgunin/reverseengineeranything/blob/main/src/main.ts"
click node_cli "https://github.com/sgunin/reverseengineeranything/blob/main/src/cli.ts"
click node_session "https://github.com/sgunin/reverseengineeranything/blob/main/src/application/BinarySession.ts"
click node_router "https://github.com/sgunin/reverseengineeranything/blob/main/src/application/SessionProviderRouter.ts"
click node_analysis "https://github.com/sgunin/reverseengineeranything/blob/main/src/application/AnalysisProvider.ts"
click node_hopper "https://github.com/sgunin/reverseengineeranything/blob/main/src/hopper/HopperClient.ts"
click node_ghidra "https://github.com/sgunin/reverseengineeranything/blob/main/src/ghidra/GhidraClient.ts"
click node_native "https://github.com/sgunin/reverseengineeranything/blob/main/src/native/NativeMacOSProvider.ts"
click node_managed "https://github.com/sgunin/reverseengineeranything/blob/main/src/application/ManagedApplicationGraphService.ts"
click node_javascript "https://github.com/sgunin/reverseengineeranything/blob/main/src/domain/javascriptApplicationGraph.ts"
click node_semantic "https://github.com/sgunin/reverseengineeranything/blob/main/src/domain/javascriptSemanticGraph.ts"
click node_semanticquery "https://github.com/sgunin/reverseengineeranything/blob/main/src/domain/javascriptSemanticQuery.ts"
click node_browserprovider "https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpBrowserProvider.ts"
click node_cdpconnection "https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpConnection.ts"
click node_capture "https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpCaptureEventHandlers.ts"
click node_storage "https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpCaptureStorage.ts"
click node_coverage "https://github.com/sgunin/reverseengineeranything/blob/main/src/application/ReconstructionCoverageService.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_mcp,node_cli toneBlue
class node_session,node_router,node_analysis toneAmber
class node_hopper,node_ghidra,node_native,node_managed toneMint
class node_browserprovider,node_cdpconnection,node_capture,node_storage toneRose
class node_javascript,node_semantic,node_semanticquery,node_coverage,node_agent,node_engineer toneIndigo
```

## Components

### Entry points

- [MCP server](https://github.com/sgunin/reverseengineeranything/blob/main/src/main.ts): `src/main.ts`
- [CLI](https://github.com/sgunin/reverseengineeranything/blob/main/src/cli.ts): `src/cli.ts`

### Analysis coordination

- [Binary session](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/BinarySession.ts): `src/application/BinarySession.ts`
- [Provider router](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/SessionProviderRouter.ts): `src/application/SessionProviderRouter.ts`
- [Analysis provider](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/AnalysisProvider.ts): `src/application/AnalysisProvider.ts`

### Analysis providers

- [Hopper bridge](https://github.com/sgunin/reverseengineeranything/blob/main/src/hopper/HopperClient.ts): `src/hopper/HopperClient.ts`
- [Ghidra bridge](https://github.com/sgunin/reverseengineeranything/blob/main/src/ghidra/GhidraClient.ts): `src/ghidra/GhidraClient.ts`
- [Native analysis](https://github.com/sgunin/reverseengineeranything/blob/main/src/native/NativeMacOSProvider.ts): `src/native/NativeMacOSProvider.ts`
- [.NET analysis](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/ManagedApplicationGraphService.ts): `src/application/ManagedApplicationGraphService.ts`

### Web observation

- [CDP provider](https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpBrowserProvider.ts): `src/browser/CdpBrowserProvider.ts`
- [CDP connection](https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpConnection.ts): `src/browser/CdpConnection.ts`
- [Capture handlers](https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpCaptureEventHandlers.ts): `src/browser/CdpCaptureEventHandlers.ts`
- [Storage capture](https://github.com/sgunin/reverseengineeranything/blob/main/src/browser/CdpCaptureStorage.ts): `src/browser/CdpCaptureStorage.ts`

### Analysis models

- [JavaScript analysis](https://github.com/sgunin/reverseengineeranything/blob/main/src/domain/javascriptApplicationGraph.ts): `src/domain/javascriptApplicationGraph.ts`
- [Semantic graph](https://github.com/sgunin/reverseengineeranything/blob/main/src/domain/javascriptSemanticGraph.ts): `src/domain/javascriptSemanticGraph.ts`
- [Graph query](https://github.com/sgunin/reverseengineeranything/blob/main/src/domain/javascriptSemanticQuery.ts): `src/domain/javascriptSemanticQuery.ts`
- [Reconstruction coverage](https://github.com/sgunin/reverseengineeranything/blob/main/src/application/ReconstructionCoverageService.ts): `src/application/ReconstructionCoverageService.ts`

### Other components

- **AI agent**
- **Engineer**

## Connections

- AI agent → MCP server: uses tools (evidence: `README.md`)
- Engineer → CLI: runs analysis (evidence: `README.md`)
- MCP server → Binary session: creates session (evidence: `src/main.ts`)
- MCP server → Provider router: starts transport (evidence: `src/main.ts`)
- Provider router → Analysis provider: selects provider (evidence: `src/application/SessionProviderRouter.ts`)
- Analysis provider → Hopper bridge: uses provider
- Analysis provider → Ghidra bridge: uses provider
- Engineer → Native analysis: investigates binaries (evidence: `README.md`)
- Engineer → .NET analysis: investigates assemblies (evidence: `README.md`)
- Engineer → JavaScript analysis: investigates apps (evidence: `README.md`)
- JavaScript analysis → Semantic graph: builds graph (evidence: `src/domain/javascriptSemanticGraph.ts`)
- Semantic graph → Graph query: queried by (evidence: `src/domain/javascriptSemanticQuery.ts`)
- Engineer → CDP provider: investigates websites (evidence: `README.md`)
- CDP provider → CDP connection: uses connection
- Capture handlers → CDP connection: issues commands
- Storage capture → CDP connection: issues commands (evidence: `src/browser/CdpCaptureStorage.ts`)
- Engineer → Reconstruction coverage: checks reconstruction
