# zhengyishen3-dot/rea architecture

> Architecture diagram of the GitHub repository zhengyishen3-dot/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/zhengyishen3-dot/rea
- Repository: https://github.com/zhengyishen3-dot/rea

## Overview

REA is a local reverse-engineering toolkit exposed through MCP and CLI. The principal workflow is an agent or terminal user submitting an investigation, REA routing it to target-specific analysis, and returning findings with evidence and limitations. The repository also contains distinct browser, Android, JavaScript/Electron, and binary-diagnostics capabilities. Edges are limited to README statements and SOURCE INDEX references; several feature-specific runtime connections are not evidenced in the excerpts, so they are left unlinked or marked unverified.

Main entry points: [`src/application/reverse/ReverseEngineeringService.ts`](https://github.com/zhengyishen3-dot/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts) (Reverse engineering), [`src/cli/reverseEngineeringCommands.ts`](https://github.com/zhengyishen3-dot/rea/blob/main/src/cli/reverseEngineeringCommands.ts) (CLI commands), [`src/browser/CdpCaptureStorage.ts`](https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/CdpCaptureStorage.ts) (Browser observations), [`src/domain/evidence.ts`](https://github.com/zhengyishen3-dot/rea/blob/main/src/domain/evidence.ts) (Evidence records)

## Diagram (Mermaid)

```mermaid
flowchart TD

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

subgraph group_workflow["Analysis workflows"]
  node_reverse["Reverse engineering"]
  node_reverseport["Command port"]
  node_jsanalysis["JavaScript analysis"]
  node_web["Web runtime"]
  node_webcapture["Network capture"]
  node_android["Android analysis"]
  node_browserstore["Browser observations"]
  node_scenario["Browser scenarios"]
end

subgraph group_providers["Analysis providers"]
  node_ghidra["Ghidra provider"]
  node_hopper["Hopper provider<br/>[HopperClient.ts]"]
  node_ida["IDA provider"]
  node_gdb["GDB sessions"]
  node_rizin["Rizin sessions"]
end

subgraph group_domain["Evidence and domain"]
  node_evidence["Evidence records<br/>[evidence.ts]"]
  node_contracts["Tool contracts"]
  node_errors["Error projection"]
  node_sqlite["SQLite inspection"]
  node_capturedb[("Capture storage")]
end

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

node_agent -->|"calls tools"| node_mcp
node_terminal -->|"runs commands"| node_cli
node_cli -->|"creates service"| node_reverse
node_reverse -->|"uses commands"| node_reverseport
node_cli -->|"opens sessions"| node_gdb
node_cli -.->|"offers debugging"| node_rizin
node_reverse -.->|"retains findings"| node_evidence
node_reverse -.->|"projects failures"| node_errors
node_agent -.->|"requests analysis"| node_jsanalysis
node_agent -.->|"requests inspection"| node_web
node_agent -.->|"requests capture"| node_webcapture
node_agent -.->|"requests analysis"| node_android
node_agent -.->|"requests evidence"| node_browserstore
node_agent -.->|"requests scenarios"| node_scenario
node_reverse -.->|"selects provider"| node_ghidra
node_reverse -.->|"selects provider"| node_hopper
node_reverse -.->|"selects provider"| node_ida
node_contracts -.->|"defines output"| node_evidence
node_browserstore -->|"persists observations"| node_capturedb

click node_mcp "https://github.com/zhengyishen3-dot/rea/blob/main/src/main.ts"
click node_cli "https://github.com/zhengyishen3-dot/rea/blob/main/src/cli/reverseEngineeringCommands.ts"
click node_reverse "https://github.com/zhengyishen3-dot/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts"
click node_reverseport "https://github.com/zhengyishen3-dot/rea/blob/main/src/application/reverse/ReverseEngineeringCommandPort.ts"
click node_jsanalysis "https://github.com/zhengyishen3-dot/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts"
click node_web "https://github.com/zhengyishen3-dot/rea/blob/main/src/application/WebRuntimeService.ts"
click node_webcapture "https://github.com/zhengyishen3-dot/rea/blob/main/src/application/WebNetworkCaptureService.ts"
click node_android "https://github.com/zhengyishen3-dot/rea/blob/main/src/application/android/AndroidAnalysisService.ts"
click node_browserstore "https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/CdpCaptureStorage.ts"
click node_scenario "https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/PlaywrightScenarioStorage.ts"
click node_ghidra "https://github.com/zhengyishen3-dot/rea/blob/main/src/ghidra/GhidraProviderClient.ts"
click node_hopper "https://github.com/zhengyishen3-dot/rea/blob/main/src/hopper/HopperClient.ts"
click node_ida "https://github.com/zhengyishen3-dot/rea/blob/main/src/ida/IdaSessionClient.ts"
click node_gdb "https://github.com/zhengyishen3-dot/rea/blob/main/src/gdb/GdbSessionManager.ts"
click node_rizin "https://github.com/zhengyishen3-dot/rea/blob/main/src/rizin/RizinDebugSessionManager.ts"
click node_evidence "https://github.com/zhengyishen3-dot/rea/blob/main/src/domain/evidence.ts"
click node_contracts "https://github.com/zhengyishen3-dot/rea/blob/main/src/contracts/reverseEngineeringToolContracts.ts"
click node_errors "https://github.com/zhengyishen3-dot/rea/blob/main/src/domain/analysisErrorProjection.ts"
click node_sqlite "https://github.com/zhengyishen3-dot/rea/blob/main/src/sqlite/SqliteDatabaseInspection.ts"
click node_capturedb "https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/CdpCaptureStorage.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_terminal toneBlue
class node_reverse,node_reverseport,node_jsanalysis,node_web,node_webcapture,node_android,node_browserstore,node_scenario toneAmber
class node_ghidra,node_hopper,node_ida,node_gdb,node_rizin toneMint
class node_evidence,node_contracts,node_errors,node_sqlite,node_capturedb toneRose
class node_agent toneIndigo
```

## Components

### Entry points

- [MCP server](https://github.com/zhengyishen3-dot/rea/blob/main/src/main.ts): `src/main.ts`
- [CLI commands](https://github.com/zhengyishen3-dot/rea/blob/main/src/cli/reverseEngineeringCommands.ts): `src/cli/reverseEngineeringCommands.ts`

### Analysis workflows

- [Reverse engineering](https://github.com/zhengyishen3-dot/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts): `src/application/reverse/ReverseEngineeringService.ts`
- [Command port](https://github.com/zhengyishen3-dot/rea/blob/main/src/application/reverse/ReverseEngineeringCommandPort.ts): `src/application/reverse/ReverseEngineeringCommandPort.ts`
- [JavaScript analysis](https://github.com/zhengyishen3-dot/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts): `src/javascript/analysis/JavaScriptAnalysisWorker.ts`
- [Web runtime](https://github.com/zhengyishen3-dot/rea/blob/main/src/application/WebRuntimeService.ts): `src/application/WebRuntimeService.ts`
- [Network capture](https://github.com/zhengyishen3-dot/rea/blob/main/src/application/WebNetworkCaptureService.ts): `src/application/WebNetworkCaptureService.ts`
- [Android analysis](https://github.com/zhengyishen3-dot/rea/blob/main/src/application/android/AndroidAnalysisService.ts): `src/application/android/AndroidAnalysisService.ts`
- [Browser observations](https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/CdpCaptureStorage.ts): `src/browser/CdpCaptureStorage.ts`
- [Browser scenarios](https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/PlaywrightScenarioStorage.ts): `src/browser/PlaywrightScenarioStorage.ts`

### Analysis providers

- [Ghidra provider](https://github.com/zhengyishen3-dot/rea/blob/main/src/ghidra/GhidraProviderClient.ts): `src/ghidra/GhidraProviderClient.ts`
- [Hopper provider](https://github.com/zhengyishen3-dot/rea/blob/main/src/hopper/HopperClient.ts): `src/hopper/HopperClient.ts`
- [IDA provider](https://github.com/zhengyishen3-dot/rea/blob/main/src/ida/IdaSessionClient.ts): `src/ida/IdaSessionClient.ts`
- [GDB sessions](https://github.com/zhengyishen3-dot/rea/blob/main/src/gdb/GdbSessionManager.ts): `src/gdb/GdbSessionManager.ts`
- [Rizin sessions](https://github.com/zhengyishen3-dot/rea/blob/main/src/rizin/RizinDebugSessionManager.ts): `src/rizin/RizinDebugSessionManager.ts`

### Evidence and domain

- [Evidence records](https://github.com/zhengyishen3-dot/rea/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`
- [Tool contracts](https://github.com/zhengyishen3-dot/rea/blob/main/src/contracts/reverseEngineeringToolContracts.ts): `src/contracts/reverseEngineeringToolContracts.ts`
- [Error projection](https://github.com/zhengyishen3-dot/rea/blob/main/src/domain/analysisErrorProjection.ts): `src/domain/analysisErrorProjection.ts`
- [SQLite inspection](https://github.com/zhengyishen3-dot/rea/blob/main/src/sqlite/SqliteDatabaseInspection.ts): `src/sqlite/SqliteDatabaseInspection.ts`
- [Capture storage](https://github.com/zhengyishen3-dot/rea/blob/main/src/browser/CdpCaptureStorage.ts): `src/browser/CdpCaptureStorage.ts`

### Other components

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

## Connections

- Agent → MCP server: calls tools (evidence: `README.md`)
- Terminal user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Reverse engineering: creates service (evidence: `src/cli/reverseEngineeringCommands.ts`)
- Reverse engineering → Command port: uses commands (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- CLI commands → GDB sessions: opens sessions (evidence: `src/cli/reverseEngineeringCommands.ts`)
- CLI commands → Rizin sessions: offers debugging (evidence: `src/cli/reverseEngineeringCommands.ts`)
- Reverse engineering → Evidence records: retains findings (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Reverse engineering → Error projection: projects failures
- Agent → JavaScript analysis: requests analysis
- Agent → Web runtime: requests inspection
- Agent → Network capture: requests capture
- Agent → Android analysis: requests analysis
- Agent → Browser observations: requests evidence
- Agent → Browser scenarios: requests scenarios
- Reverse engineering → Ghidra provider: selects provider
- Reverse engineering → Hopper provider: selects provider
- Reverse engineering → IDA provider: selects provider
- Tool contracts → Evidence records: defines output
- Browser observations → Capture storage: persists observations (evidence: `src/browser/CdpCaptureStorage.ts`)
