# fxagro/rea architecture

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

## Overview

REA is a local reverse-engineering toolkit exposed through an MCP server and CLI. The main workflow is an agent or terminal user requesting an investigation, REA dispatching analysis to target-specific tooling, and returning findings with evidence and limitations. Its documented scope spans native binaries, managed and mobile applications, JavaScript/Electron, websites, and runtime behavior. The graph preserves those capability branches and the shared provider/evidence layers; several connections are documented at product level because the sampled source does not show all runtime wiring.

Main entry points: [`src/application`](https://github.com/fxagro/rea/tree/main/src/application) (Investigation workflows), [`src/main.ts`](https://github.com/fxagro/rea/blob/main/src/main.ts) (MCP server), [`src/domain/evidence.ts`](https://github.com/fxagro/rea/blob/main/src/domain/evidence.ts) (Evidence model), [`src/cli`](https://github.com/fxagro/rea/tree/main/src/cli) (CLI workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

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

subgraph group_orchestration["Analysis orchestration"]
  node_application["Investigation workflows"]
  node_provider_contract["Provider contract"]
  node_binary_sessions["Binary sessions"]
end

subgraph group_targets["Target analysis"]
  node_native_providers["Native providers"]
  node_debug_sessions["Debugger sessions"]
  node_reverse_commands["Reverse commands"]
  node_javascript_analysis["JavaScript analysis"]
  node_browser_analysis["Browser analysis"]
  node_android_analysis["Android analysis"]
  node_mobile_bridges["Tool bridges"]
end

subgraph group_evidence["Evidence and runtime"]
  node_evidence_model["Evidence model<br/>[evidence.ts]"]
  node_error_model["Error projections"]
  node_process_supervision["Process supervision<br/>[ProviderProcess.ts]"]
  node_sqlite["SQLite inspection"]
end

node_agent(("Agent"))
node_terminal(("Terminal user"))
node_target["Local target"]

node_agent -->|"requests analysis"| node_mcp
node_terminal -->|"runs workflows"| node_cli
node_mcp -.->|"exposes tools"| node_tool_registration
node_cli -->|"uses workflows"| node_application
node_mcp -.->|"dispatches investigations"| node_application
node_application -.->|"selects providers"| node_provider_contract
node_provider_contract -.->|"opens sessions"| node_binary_sessions
node_binary_sessions -.->|"uses analysis engines"| node_native_providers
node_application -->|"runs reverse commands"| node_reverse_commands
node_application -.->|"analyzes applications"| node_javascript_analysis
node_application -.->|"observes browser behavior"| node_browser_analysis
node_application -.->|"inspects Android"| node_android_analysis
node_android_analysis -.->|"uses bridges"| node_mobile_bridges
node_native_providers -.->|"returns findings"| node_evidence_model
node_debug_sessions -->|"supervises processes"| node_process_supervision
node_reverse_commands -->|"runs owned commands"| node_process_supervision
node_application -.->|"builds evidence"| node_evidence_model
node_application -.->|"projects failures"| node_error_model
node_application -.->|"inspects databases"| node_sqlite
node_application -->|"inspects locally"| node_target
node_evidence_model -->|"returns findings"| node_agent

click node_mcp "https://github.com/fxagro/rea/blob/main/src/main.ts"
click node_cli "https://github.com/fxagro/rea/tree/main/src/cli"
click node_tool_registration "https://github.com/fxagro/rea/tree/main/src/server"
click node_application "https://github.com/fxagro/rea/tree/main/src/application"
click node_provider_contract "https://github.com/fxagro/rea/blob/main/src/application/AnalysisProvider.ts"
click node_binary_sessions "https://github.com/fxagro/rea/tree/main/src/application/binary"
click node_native_providers "https://github.com/fxagro/rea/blob/main/src/ghidra/GhidraProviderClient.ts"
click node_debug_sessions "https://github.com/fxagro/rea/blob/main/src/gdb/GdbSessionManager.ts"
click node_reverse_commands "https://github.com/fxagro/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts"
click node_javascript_analysis "https://github.com/fxagro/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts"
click node_browser_analysis "https://github.com/fxagro/rea/tree/main/src/browser"
click node_android_analysis "https://github.com/fxagro/rea/tree/main/src/android"
click node_mobile_bridges "https://github.com/fxagro/rea/tree/main/bridge"
click node_evidence_model "https://github.com/fxagro/rea/blob/main/src/domain/evidence.ts"
click node_error_model "https://github.com/fxagro/rea/blob/main/src/domain/analysisErrorProjection.ts"
click node_process_supervision "https://github.com/fxagro/rea/blob/main/src/process/ProviderProcess.ts"
click node_sqlite "https://github.com/fxagro/rea/blob/main/src/sqlite/SqliteDatabaseInspection.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_registration,node_terminal toneBlue
class node_application,node_provider_contract,node_binary_sessions toneAmber
class node_native_providers,node_debug_sessions,node_reverse_commands,node_javascript_analysis,node_browser_analysis,node_android_analysis,node_mobile_bridges toneMint
class node_evidence_model,node_error_model,node_process_supervision,node_sqlite toneRose
class node_agent,node_target toneIndigo
```

## Components

### Entry points

- [MCP server](https://github.com/fxagro/rea/blob/main/src/main.ts): `src/main.ts`
- [CLI workflows](https://github.com/fxagro/rea/tree/main/src/cli): `src/cli`
- [Analysis tools](https://github.com/fxagro/rea/tree/main/src/server): `src/server`

### Analysis orchestration

- [Investigation workflows](https://github.com/fxagro/rea/tree/main/src/application): `src/application`
- [Provider contract](https://github.com/fxagro/rea/blob/main/src/application/AnalysisProvider.ts): `src/application/AnalysisProvider.ts`
- [Binary sessions](https://github.com/fxagro/rea/tree/main/src/application/binary): `src/application/binary`

### Target analysis

- [Native providers](https://github.com/fxagro/rea/blob/main/src/ghidra/GhidraProviderClient.ts): `src/ghidra/GhidraProviderClient.ts`
- [Debugger sessions](https://github.com/fxagro/rea/blob/main/src/gdb/GdbSessionManager.ts): `src/gdb/GdbSessionManager.ts`
- [Reverse commands](https://github.com/fxagro/rea/blob/main/src/application/reverse/ReverseEngineeringService.ts): `src/application/reverse/ReverseEngineeringService.ts`
- [JavaScript analysis](https://github.com/fxagro/rea/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts): `src/javascript/analysis/JavaScriptAnalysisWorker.ts`
- [Browser analysis](https://github.com/fxagro/rea/tree/main/src/browser): `src/browser`
- [Android analysis](https://github.com/fxagro/rea/tree/main/src/android): `src/android`
- [Tool bridges](https://github.com/fxagro/rea/tree/main/bridge): `bridge`

### Evidence and runtime

- [Evidence model](https://github.com/fxagro/rea/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`
- [Error projections](https://github.com/fxagro/rea/blob/main/src/domain/analysisErrorProjection.ts): `src/domain/analysisErrorProjection.ts`
- [Process supervision](https://github.com/fxagro/rea/blob/main/src/process/ProviderProcess.ts): `src/process/ProviderProcess.ts`
- [SQLite inspection](https://github.com/fxagro/rea/blob/main/src/sqlite/SqliteDatabaseInspection.ts): `src/sqlite/SqliteDatabaseInspection.ts`

### Other components

- **Agent**
- **Terminal user**
- **Local target**

## Connections

- Agent → MCP server: requests analysis (evidence: `README.md`)
- Terminal user → CLI workflows: runs workflows (evidence: `README.md`)
- MCP server → Analysis tools: exposes tools (evidence: `src/main.ts`)
- CLI workflows → Investigation workflows: uses workflows (evidence: `README.md`)
- MCP server → Investigation workflows: dispatches investigations
- Investigation workflows → Provider contract: selects providers (evidence: `src/application/AnalysisProvider.ts`)
- Provider contract → Binary sessions: opens sessions
- Binary sessions → Native providers: uses analysis engines
- Investigation workflows → Reverse commands: runs reverse commands (evidence: `src/cli/reverseEngineeringCommands.ts`)
- Investigation workflows → JavaScript analysis: analyzes applications
- Investigation workflows → Browser analysis: observes browser behavior
- Investigation workflows → Android analysis: inspects Android
- Android analysis → Tool bridges: uses bridges
- Native providers → Evidence model: returns findings (evidence: `src/ghidra/GhidraProviderClient.ts`)
- Debugger sessions → Process supervision: supervises processes (evidence: `src/gdb/GdbSessionManager.ts`)
- Reverse commands → Process supervision: runs owned commands (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Investigation workflows → Evidence model: builds evidence (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Investigation workflows → Error projections: projects failures
- Investigation workflows → SQLite inspection: inspects databases
- Investigation workflows → Local target: inspects locally (evidence: `README.md`)
- Evidence model → Agent: returns findings (evidence: `README.md`)
