# 1224425883/rea architecture

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

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

## Overview

REA is a local reverse-engineering MCP server and CLI. The principal workflow is an agent or terminal user submitting an investigation, REA routing it through an application workflow to an appropriate analysis provider, and returning findings with evidence and limitations. The repository also exposes distinct browser, JavaScript/Electron, Android, and artifact-diagnostics capabilities. The graph combines README-documented behavior with source-index references; unsampled subsystem internals and their wiring are represented conservatively.

Main entry points: [`src/application`](https://github.com/1224425883/rea/tree/main/src/application) (Investigation workflows), [`src/application/reverse/ReverseEngineeringService.ts`](https://github.com/1224425883/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts) (Reverse operations), [`src/domain/evidence.ts`](https://github.com/1224425883/rea/blob/main/src/domain/evidence.ts) (Evidence records), [`src/cli/reverseEngineeringCommands.ts`](https://github.com/1224425883/rea/blob/main/src/cli/reverseEngineeringCommands.ts) (Reverse commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_mcp["MCP server<br/>[main.ts]"]
  node_cli["CLI commands<br/>[cli.ts]"]
  node_reverse_cli["Reverse commands"]
  node_tools["MCP tool handlers"]
end

subgraph group_core["Analysis orchestration"]
  node_workflow["Investigation workflows"]
  node_providers["Provider registry"]
  node_binary_sessions["Binary sessions"]
  node_reverse_service["Reverse operations"]
end

subgraph group_binary["Binary analysis"]
  node_provider_adapters["Native providers"]
  node_debuggers["Debugger sessions"]
  node_rizin["Rizin sessions"]
  node_cutter["Cutter bridge"]
  node_binary_diagnostics["Binary diagnostics"]
end

subgraph group_app["Application analysis"]
  node_js_workflow["JavaScript analysis"]
  node_js_worker["Static analysis worker"]
  node_browser["Browser observation"]
  node_android["Android analysis"]
  node_apple["Apple analysis"]
end

subgraph group_domain["Evidence and domain"]
  node_evidence["Evidence records<br/>[evidence.ts]"]
  node_errors["Analysis errors"]
  node_reverse_contract["Reverse input schemas"]
  node_process["Owned processes<br/>[ProviderProcess.ts]"]
  node_ownership["Process ownership"]
end

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

node_agent -->|"asks via MCP"| node_mcp
node_terminal -->|"runs commands"| node_cli
node_mcp -->|"registers tools"| node_tools
node_cli -->|"routes commands"| node_reverse_cli
node_reverse_cli -->|"creates service"| node_reverse_service
node_tools -->|"invokes operations"| node_reverse_service
node_tools -.->|"serves investigations"| node_workflow
node_workflow -.->|"selects provider"| node_providers
node_providers -.->|"opens sessions"| node_binary_sessions
node_binary_sessions -.->|"routes analysis"| node_provider_adapters
node_reverse_service -->|"validates inputs"| node_reverse_contract
node_reverse_service -->|"retains evidence"| node_evidence
node_reverse_cli -->|"starts sessions"| node_debuggers
node_reverse_cli -->|"starts sessions"| node_rizin
node_reverse_service -->|"runs commands"| node_process
node_debuggers -.->|"supervises processes"| node_process
node_process -->|"checks ownership"| node_ownership
node_provider_adapters -.->|"returns findings"| node_evidence
node_workflow -.->|"analyzes layouts"| node_binary_diagnostics
node_workflow -.->|"analyzes applications"| node_js_workflow
node_js_workflow -.->|"runs static analysis"| node_js_worker
node_workflow -.->|"observes runtime"| node_browser
node_workflow -.->|"inspects packages"| node_android
node_workflow -.->|"inspects applications"| node_apple
node_js_worker -.->|"returns findings"| node_evidence
node_browser -.->|"records observations"| node_evidence
node_android -.->|"returns findings"| node_evidence
node_reverse_service -->|"reports failures"| node_errors
node_cutter -->|"reports failures"| node_errors

click node_mcp "https://github.com/1224425883/rea/blob/main/src/main.ts"
click node_cli "https://github.com/1224425883/rea/blob/main/src/cli.ts"
click node_reverse_cli "https://github.com/1224425883/rea/blob/main/src/cli/reverseEngineeringCommands.ts"
click node_tools "https://github.com/1224425883/rea/blob/main/src/server/registerReverseEngineeringTools.ts"
click node_workflow "https://github.com/1224425883/rea/tree/main/src/application"
click node_providers "https://github.com/1224425883/rea/blob/main/src/application/AnalysisProvider.ts"
click node_binary_sessions "https://github.com/1224425883/rea/tree/main/src/application/binary"
click node_reverse_service "https://github.com/1224425883/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts"
click node_provider_adapters "https://github.com/1224425883/rea/blob/main/src/ghidra/GhidraProviderClient.ts"
click node_debuggers "https://github.com/1224425883/rea/blob/main/src/gdb/GdbSessionManager.ts"
click node_rizin "https://github.com/1224425883/rea/blob/main/src/rizin/RizinDebugSessionManager.ts"
click node_cutter "https://github.com/1224425883/rea/blob/main/src/cutter/CutterBridgeClient.ts"
click node_binary_diagnostics "https://github.com/1224425883/rea/tree/main/src/application/binaryDiagnostics"
click node_js_workflow "https://github.com/1224425883/rea/blob/main/src/application/javascript/JavaScriptApplicationWorkflowService.ts"
click node_js_worker "https://github.com/1224425883/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts"
click node_browser "https://github.com/1224425883/rea/blob/main/src/application/BrowserObservationService.ts"
click node_android "https://github.com/1224425883/rea/blob/main/src/application/android/AndroidAnalysisService.ts"
click node_apple "https://github.com/1224425883/rea/blob/main/src/application/apple/AppleApplicationService.ts"
click node_evidence "https://github.com/1224425883/rea/blob/main/src/domain/evidence.ts"
click node_errors "https://github.com/1224425883/rea/blob/main/src/domain/analysisErrorBase.ts"
click node_reverse_contract "https://github.com/1224425883/rea/blob/main/src/domain/reverseEngineering.ts"
click node_process "https://github.com/1224425883/rea/blob/main/src/process/ProviderProcess.ts"
click node_ownership "https://github.com/1224425883/rea/blob/main/src/process/ProcessOwnershipObservation.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_reverse_cli,node_tools,node_terminal toneBlue
class node_workflow,node_providers,node_binary_sessions,node_reverse_service toneAmber
class node_provider_adapters,node_debuggers,node_rizin,node_cutter,node_binary_diagnostics toneMint
class node_js_workflow,node_js_worker,node_browser,node_android,node_apple toneRose
class node_evidence,node_errors,node_reverse_contract,node_process,node_ownership,node_agent toneIndigo
```

## Components

### User interfaces

- [MCP server](https://github.com/1224425883/rea/blob/main/src/main.ts): `src/main.ts`
- [CLI commands](https://github.com/1224425883/rea/blob/main/src/cli.ts): `src/cli.ts`
- [Reverse commands](https://github.com/1224425883/rea/blob/main/src/cli/reverseEngineeringCommands.ts): `src/cli/reverseEngineeringCommands.ts`
- [MCP tool handlers](https://github.com/1224425883/rea/blob/main/src/server/registerReverseEngineeringTools.ts): `src/server/registerReverseEngineeringTools.ts`

### Analysis orchestration

- [Investigation workflows](https://github.com/1224425883/rea/tree/main/src/application): `src/application`
- [Provider registry](https://github.com/1224425883/rea/blob/main/src/application/AnalysisProvider.ts): `src/application/AnalysisProvider.ts`
- [Binary sessions](https://github.com/1224425883/rea/tree/main/src/application/binary): `src/application/binary`
- [Reverse operations](https://github.com/1224425883/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts): `src/application/reverse/ReverseEngineeringService.ts`

### Binary analysis

- [Native providers](https://github.com/1224425883/rea/blob/main/src/ghidra/GhidraProviderClient.ts): `src/ghidra/GhidraProviderClient.ts`
- [Debugger sessions](https://github.com/1224425883/rea/blob/main/src/gdb/GdbSessionManager.ts): `src/gdb/GdbSessionManager.ts`
- [Rizin sessions](https://github.com/1224425883/rea/blob/main/src/rizin/RizinDebugSessionManager.ts): `src/rizin/RizinDebugSessionManager.ts`
- [Cutter bridge](https://github.com/1224425883/rea/blob/main/src/cutter/CutterBridgeClient.ts): `src/cutter/CutterBridgeClient.ts`
- [Binary diagnostics](https://github.com/1224425883/rea/tree/main/src/application/binaryDiagnostics): `src/application/binaryDiagnostics`

### Application analysis

- [JavaScript analysis](https://github.com/1224425883/rea/blob/main/src/application/javascript/JavaScriptApplicationWorkflowService.ts): `src/application/javascript/JavaScriptApplicationWorkflowService.ts`
- [Static analysis worker](https://github.com/1224425883/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts): `src/javascript/analysis/JavaScriptAnalysisWorker.ts`
- [Browser observation](https://github.com/1224425883/rea/blob/main/src/application/BrowserObservationService.ts): `src/application/BrowserObservationService.ts`
- [Android analysis](https://github.com/1224425883/rea/blob/main/src/application/android/AndroidAnalysisService.ts): `src/application/android/AndroidAnalysisService.ts`
- [Apple analysis](https://github.com/1224425883/rea/blob/main/src/application/apple/AppleApplicationService.ts): `src/application/apple/AppleApplicationService.ts`

### Evidence and domain

- [Evidence records](https://github.com/1224425883/rea/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`
- [Analysis errors](https://github.com/1224425883/rea/blob/main/src/domain/analysisErrorBase.ts): `src/domain/analysisErrorBase.ts`
- [Reverse input schemas](https://github.com/1224425883/rea/blob/main/src/domain/reverseEngineering.ts): `src/domain/reverseEngineering.ts`
- [Owned processes](https://github.com/1224425883/rea/blob/main/src/process/ProviderProcess.ts): `src/process/ProviderProcess.ts`
- [Process ownership](https://github.com/1224425883/rea/blob/main/src/process/ProcessOwnershipObservation.ts): `src/process/ProcessOwnershipObservation.ts`

### Other components

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

## Connections

- Agent → MCP server: asks via MCP (evidence: `README.md`)
- Terminal user → CLI commands: runs commands (evidence: `README.md`)
- MCP server → MCP tool handlers: registers tools (evidence: `src/main.ts`)
- CLI commands → Reverse commands: routes commands (evidence: `src/cli/reverseEngineeringCommands.ts`)
- Reverse commands → Reverse operations: creates service (evidence: `src/cli/reverseEngineeringCommands.ts`)
- MCP tool handlers → Reverse operations: invokes operations (evidence: `src/server/registerReverseEngineeringTools.ts`)
- MCP tool handlers → Investigation workflows: serves investigations (evidence: `README.md`)
- Investigation workflows → Provider registry: selects provider (evidence: `src/application/AnalysisProvider.ts`)
- Provider registry → Binary sessions: opens sessions
- Binary sessions → Native providers: routes analysis
- Reverse operations → Reverse input schemas: validates inputs (evidence: `src/domain/reverseEngineering.ts`)
- Reverse operations → Evidence records: retains evidence (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Reverse commands → Debugger sessions: starts sessions (evidence: `src/cli/reverseEngineeringCommands.ts`)
- Reverse commands → Rizin sessions: starts sessions (evidence: `src/cli/reverseEngineeringCommands.ts`)
- Reverse operations → Owned processes: runs commands (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Debugger sessions → Owned processes: supervises processes (evidence: `src/gdb/GdbSessionManager.ts`)
- Owned processes → Process ownership: checks ownership (evidence: `src/process/ProviderProcess.ts`)
- Native providers → Evidence records: returns findings (evidence: `src/ghidra/GhidraProviderClient.ts`)
- Investigation workflows → Binary diagnostics: analyzes layouts
- Investigation workflows → JavaScript analysis: analyzes applications
- JavaScript analysis → Static analysis worker: runs static analysis
- Investigation workflows → Browser observation: observes runtime
- Investigation workflows → Android analysis: inspects packages
- Investigation workflows → Apple analysis: inspects applications
- Static analysis worker → Evidence records: returns findings
- Browser observation → Evidence records: records observations
- Android analysis → Evidence records: returns findings
- Reverse operations → Analysis errors: reports failures (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Cutter bridge → Analysis errors: reports failures (evidence: `src/cutter/CutterBridgeClient.ts`)
