# amr-ahmed0/rea architecture

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

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

## Overview

REA is a local reverse-engineering toolkit exposed through MCP and the CLI. An agent or terminal user requests an investigation; REA dispatches analysis across native binaries, application/runtime behavior, and specialized targets, then returns findings with evidence and limitations. The graph preserves README-described capabilities even where their implementation was not sampled. Source-index references support only the shown wiring; broader capability links are documented in the README, not verified call paths.

Main entry points: [`src/application/reverse/ReverseEngineeringService.ts`](https://github.com/amr-ahmed0/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts) (Reverse analysis), [`src/main.ts`](https://github.com/amr-ahmed0/rea/blob/main/src/main.ts) (MCP server), [`src/cli/reverseEngineeringCommands.ts`](https://github.com/amr-ahmed0/rea/blob/main/src/cli/reverseEngineeringCommands.ts) (CLI commands), [`src/server/registerReverseEngineeringTools.ts`](https://github.com/amr-ahmed0/rea/blob/main/src/server/registerReverseEngineeringTools.ts) (Tool registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

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

subgraph group_analysis["Analysis workflows"]
  node_reverse_service["Reverse analysis"]
  node_js_analysis["JavaScript analysis"]
  node_browser_capture["Browser observation"]
  node_web_analysis["Web analysis"]
  node_android_analysis["Android analysis<br/>[JadxProvider.ts]"]
end

subgraph group_providers["Analysis engines"]
  node_ghidra["Ghidra adapter"]
  node_hopper["Hopper adapter<br/>[HopperClient.ts]"]
  node_ida["IDA adapter"]
  node_debug_sessions["Debug sessions"]
  node_process_supervision["Process supervision<br/>[ProviderProcess.ts]"]
end

subgraph group_evidence["Evidence and results"]
  node_evidence["Evidence records<br/>[evidence.ts]"]
  node_error_projection["Result projection"]
end

node_agent(("AI agent"))
node_terminal(("Terminal user"))

node_agent -->|"calls through MCP"| node_mcp
node_terminal -->|"runs commands"| node_cli
node_mcp -.->|"registers tools"| node_tool_router
node_tool_router -->|"invokes"| node_reverse_service
node_cli -->|"invokes"| node_reverse_service
node_mcp -.->|"requests analysis"| node_reverse_service
node_mcp -->|"offers analysis"| node_js_analysis
node_mcp -->|"offers observation"| node_browser_capture
node_mcp -->|"offers analysis"| node_web_analysis
node_mcp -.->|"offers analysis"| node_android_analysis
node_reverse_service -.->|"uses provider"| node_ghidra
node_reverse_service -.->|"uses provider"| node_hopper
node_reverse_service -.->|"uses provider"| node_ida
node_reverse_service -.->|"supports sessions"| node_debug_sessions
node_reverse_service -->|"supervises processes"| node_process_supervision
node_agent -->|"receives findings"| node_evidence
node_reverse_service -.->|"returns evidence"| node_evidence
node_error_projection -.->|"projects errors"| node_agent

click node_mcp "https://github.com/amr-ahmed0/rea/blob/main/src/main.ts"
click node_cli "https://github.com/amr-ahmed0/rea/blob/main/src/cli/reverseEngineeringCommands.ts"
click node_tool_router "https://github.com/amr-ahmed0/rea/blob/main/src/server/registerReverseEngineeringTools.ts"
click node_reverse_service "https://github.com/amr-ahmed0/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts"
click node_js_analysis "https://github.com/amr-ahmed0/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts"
click node_browser_capture "https://github.com/amr-ahmed0/rea/blob/main/src/application/BrowserObservationService.ts"
click node_web_analysis "https://github.com/amr-ahmed0/rea/blob/main/src/application/WebRuntimeService.ts"
click node_android_analysis "https://github.com/amr-ahmed0/rea/blob/main/src/android/JadxProvider.ts"
click node_ghidra "https://github.com/amr-ahmed0/rea/blob/main/src/ghidra/GhidraProviderClient.ts"
click node_hopper "https://github.com/amr-ahmed0/rea/blob/main/src/hopper/HopperClient.ts"
click node_ida "https://github.com/amr-ahmed0/rea/blob/main/src/ida/IdaSessionClient.ts"
click node_debug_sessions "https://github.com/amr-ahmed0/rea/blob/main/src/gdb/GdbSessionManager.ts"
click node_evidence "https://github.com/amr-ahmed0/rea/blob/main/src/domain/evidence.ts"
click node_error_projection "https://github.com/amr-ahmed0/rea/blob/main/src/domain/analysisErrorProjection.ts"
click node_process_supervision "https://github.com/amr-ahmed0/rea/blob/main/src/process/ProviderProcess.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,node_tool_router,node_terminal toneBlue
class node_reverse_service,node_js_analysis,node_browser_capture,node_web_analysis,node_android_analysis toneAmber
class node_ghidra,node_hopper,node_ida,node_debug_sessions,node_process_supervision toneMint
class node_evidence,node_error_projection toneRose
class node_agent toneIndigo
```

## Components

### Entry points

- [MCP server](https://github.com/amr-ahmed0/rea/blob/main/src/main.ts): `src/main.ts`
- [CLI commands](https://github.com/amr-ahmed0/rea/blob/main/src/cli/reverseEngineeringCommands.ts): `src/cli/reverseEngineeringCommands.ts`
- [Tool registration](https://github.com/amr-ahmed0/rea/blob/main/src/server/registerReverseEngineeringTools.ts): `src/server/registerReverseEngineeringTools.ts`

### Analysis workflows

- [Reverse analysis](https://github.com/amr-ahmed0/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts): `src/application/reverse/ReverseEngineeringService.ts`
- [JavaScript analysis](https://github.com/amr-ahmed0/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts): `src/javascript/analysis/JavaScriptAnalysisWorker.ts`
- [Browser observation](https://github.com/amr-ahmed0/rea/blob/main/src/application/BrowserObservationService.ts): `src/application/BrowserObservationService.ts`
- [Web analysis](https://github.com/amr-ahmed0/rea/blob/main/src/application/WebRuntimeService.ts): `src/application/WebRuntimeService.ts`
- [Android analysis](https://github.com/amr-ahmed0/rea/blob/main/src/android/JadxProvider.ts): `src/android/JadxProvider.ts`

### Analysis engines

- [Ghidra adapter](https://github.com/amr-ahmed0/rea/blob/main/src/ghidra/GhidraProviderClient.ts): `src/ghidra/GhidraProviderClient.ts`
- [Hopper adapter](https://github.com/amr-ahmed0/rea/blob/main/src/hopper/HopperClient.ts): `src/hopper/HopperClient.ts`
- [IDA adapter](https://github.com/amr-ahmed0/rea/blob/main/src/ida/IdaSessionClient.ts): `src/ida/IdaSessionClient.ts`
- [Debug sessions](https://github.com/amr-ahmed0/rea/blob/main/src/gdb/GdbSessionManager.ts): `src/gdb/GdbSessionManager.ts`
- [Process supervision](https://github.com/amr-ahmed0/rea/blob/main/src/process/ProviderProcess.ts): `src/process/ProviderProcess.ts`

### Evidence and results

- [Evidence records](https://github.com/amr-ahmed0/rea/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`
- [Result projection](https://github.com/amr-ahmed0/rea/blob/main/src/domain/analysisErrorProjection.ts): `src/domain/analysisErrorProjection.ts`

### Other components

- **AI agent**
- **Terminal user**

## Connections

- AI agent → MCP server: calls through MCP (evidence: `README.md`)
- Terminal user → CLI commands: runs commands (evidence: `README.md`)
- MCP server → Tool registration: registers tools
- Tool registration → Reverse analysis: invokes (evidence: `src/server/registerReverseEngineeringTools.ts`)
- CLI commands → Reverse analysis: invokes (evidence: `src/cli/reverseEngineeringCommands.ts`)
- MCP server → Reverse analysis: requests analysis
- MCP server → JavaScript analysis: offers analysis (evidence: `README.md`)
- MCP server → Browser observation: offers observation (evidence: `README.md`)
- MCP server → Web analysis: offers analysis (evidence: `README.md`)
- MCP server → Android analysis: offers analysis
- Reverse analysis → Ghidra adapter: uses provider
- Reverse analysis → Hopper adapter: uses provider
- Reverse analysis → IDA adapter: uses provider
- Reverse analysis → Debug sessions: supports sessions
- Reverse analysis → Process supervision: supervises processes (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- AI agent → Evidence records: receives findings (evidence: `README.md`)
- Reverse analysis → Evidence records: returns evidence (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Result projection → AI agent: projects errors
