# rea-gith/rea architecture

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

## Overview

REA is a local MCP reverse-engineering tool for Windows. The documented workflow is to launch its CLI or desktop entry point, connect it to a local target, and use supported reverse-engineering integrations. Major documented branches include the local agent, native Hopper/Ghidra/IDA hooks, and JavaScript/Electron/browser handling. The source excerpts are filename placeholders, so internal calls and routing cannot be verified; dashed edges mark the workflow links that remain unconfirmed. Paths identify the available implementation files, not inspected behavior.

Main entry points: [`agent/Pad.cpp`](https://github.com/rea-gith/rea/blob/main/agent/Pad.cpp) (Agent runtime), [`native/Pad.cpp`](https://github.com/rea-gith/rea/blob/main/native/Pad.cpp) (Native helpers), [`cli/Pad.cpp`](https://github.com/rea-gith/rea/blob/main/cli/Pad.cpp) (CLI runtime), [`js/Pad.cpp`](https://github.com/rea-gith/rea/blob/main/js/Pad.cpp) (JS handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and setup"]
  node_cli_setup["CLI setup<br/>[Setup.cpp]"]
  node_cli_runtime["CLI runtime<br/>[Pad.cpp]"]
  node_cli_json["JSON streaming<br/>[Json.cpp]"]
end

subgraph group_agent["Local MCP agent"]
  node_agent_prompt["Agent prompts<br/>[Prompt.cpp]"]
  node_agent_runtime["Agent runtime<br/>[Pad.cpp]"]
  node_agent_skills["Agent skills<br/>[Skill.cpp]"]
  node_agent_pin["Skill version pin<br/>[Pin.h]"]
end

subgraph group_integrations["Target integrations"]
  node_native_runtime["Native helpers<br/>[Pad.cpp]"]
  node_ghidra["Ghidra hook<br/>[Ghidra.cpp]"]
  node_hopper["Hopper hook<br/>[Hopper.h]"]
  node_ida["IDA hook<br/>[Ida.cpp]"]
  node_js_runtime["JS handling<br/>[Pad.cpp]"]
  node_electron["Electron handling<br/>[Electron.cpp]"]
  node_browser_webmcp["Browser WebMCP<br/>[Web.cpp]"]
  node_js_bundle["JS bundle<br/>[Bundle.h]"]
end

subgraph group_windows["Windows support"]
  node_windows_host["Windows host<br/>[Host.cpp]"]
  node_windows_runtime["Windows runtime<br/>[Pad.cpp]"]
  node_windows_paths["Windows paths<br/>[Path.cpp]"]
  node_windows_start["Windows start<br/>[Start.h]"]
end

node_user(("Engineer"))
node_target(("Local target"))

node_user -->|"launches"| node_cli_setup
node_user -->|"runs"| node_cli_runtime
node_cli_runtime -.->|"starts MCP"| node_agent_runtime
node_agent_runtime -.->|"connects locally"| node_target
node_agent_runtime -.->|"uses helpers"| node_native_runtime
node_native_runtime -.->|"hooks"| node_ghidra
node_native_runtime -.->|"hooks"| node_hopper
node_native_runtime -.->|"hooks"| node_ida
node_agent_runtime -.->|"uses JS path"| node_js_runtime
node_js_runtime -.->|"handles Electron"| node_electron
node_js_runtime -.->|"handles browser"| node_browser_webmcp
node_cli_runtime -.->|"streams JSON"| node_cli_json
node_user -->|"runs on Windows"| node_windows_host

click node_cli_setup "https://github.com/rea-gith/rea/blob/main/cli/Setup.cpp"
click node_cli_runtime "https://github.com/rea-gith/rea/blob/main/cli/Pad.cpp"
click node_cli_json "https://github.com/rea-gith/rea/blob/main/cli/Json.cpp"
click node_agent_prompt "https://github.com/rea-gith/rea/blob/main/agent/Prompt.cpp"
click node_agent_runtime "https://github.com/rea-gith/rea/blob/main/agent/Pad.cpp"
click node_agent_skills "https://github.com/rea-gith/rea/blob/main/agent/Skill.cpp"
click node_agent_pin "https://github.com/rea-gith/rea/blob/main/agent/Pin.h"
click node_native_runtime "https://github.com/rea-gith/rea/blob/main/native/Pad.cpp"
click node_ghidra "https://github.com/rea-gith/rea/blob/main/native/Ghidra.cpp"
click node_hopper "https://github.com/rea-gith/rea/blob/main/native/Hopper.h"
click node_ida "https://github.com/rea-gith/rea/blob/main/native/Ida.cpp"
click node_js_runtime "https://github.com/rea-gith/rea/blob/main/js/Pad.cpp"
click node_electron "https://github.com/rea-gith/rea/blob/main/js/Electron.cpp"
click node_browser_webmcp "https://github.com/rea-gith/rea/blob/main/js/Web.cpp"
click node_js_bundle "https://github.com/rea-gith/rea/blob/main/js/Bundle.h"
click node_windows_host "https://github.com/rea-gith/rea/blob/main/win/Host.cpp"
click node_windows_runtime "https://github.com/rea-gith/rea/blob/main/win/Pad.cpp"
click node_windows_paths "https://github.com/rea-gith/rea/blob/main/win/Path.cpp"
click node_windows_start "https://github.com/rea-gith/rea/blob/main/win/Start.h"

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_cli_setup,node_cli_runtime,node_cli_json toneBlue
class node_agent_prompt,node_agent_runtime,node_agent_skills,node_agent_pin toneAmber
class node_native_runtime,node_ghidra,node_hopper,node_ida,node_js_runtime,node_electron,node_browser_webmcp,node_js_bundle toneMint
class node_windows_host,node_windows_runtime,node_windows_paths,node_windows_start toneRose
class node_user,node_target toneIndigo
```

## Components

### Entry and setup

- [CLI setup](https://github.com/rea-gith/rea/blob/main/cli/Setup.cpp): `cli/Setup.cpp`
- [CLI runtime](https://github.com/rea-gith/rea/blob/main/cli/Pad.cpp): `cli/Pad.cpp`
- [JSON streaming](https://github.com/rea-gith/rea/blob/main/cli/Json.cpp): `cli/Json.cpp`

### Local MCP agent

- [Agent prompts](https://github.com/rea-gith/rea/blob/main/agent/Prompt.cpp): `agent/Prompt.cpp`
- [Agent runtime](https://github.com/rea-gith/rea/blob/main/agent/Pad.cpp): `agent/Pad.cpp`
- [Agent skills](https://github.com/rea-gith/rea/blob/main/agent/Skill.cpp): `agent/Skill.cpp`
- [Skill version pin](https://github.com/rea-gith/rea/blob/main/agent/Pin.h): `agent/Pin.h`

### Target integrations

- [Native helpers](https://github.com/rea-gith/rea/blob/main/native/Pad.cpp): `native/Pad.cpp`
- [Ghidra hook](https://github.com/rea-gith/rea/blob/main/native/Ghidra.cpp): `native/Ghidra.cpp`
- [Hopper hook](https://github.com/rea-gith/rea/blob/main/native/Hopper.h): `native/Hopper.h`
- [IDA hook](https://github.com/rea-gith/rea/blob/main/native/Ida.cpp): `native/Ida.cpp`
- [JS handling](https://github.com/rea-gith/rea/blob/main/js/Pad.cpp): `js/Pad.cpp`
- [Electron handling](https://github.com/rea-gith/rea/blob/main/js/Electron.cpp): `js/Electron.cpp`
- [Browser WebMCP](https://github.com/rea-gith/rea/blob/main/js/Web.cpp): `js/Web.cpp`
- [JS bundle](https://github.com/rea-gith/rea/blob/main/js/Bundle.h): `js/Bundle.h`

### Windows support

- [Windows host](https://github.com/rea-gith/rea/blob/main/win/Host.cpp): `win/Host.cpp`
- [Windows runtime](https://github.com/rea-gith/rea/blob/main/win/Pad.cpp): `win/Pad.cpp`
- [Windows paths](https://github.com/rea-gith/rea/blob/main/win/Path.cpp): `win/Path.cpp`
- [Windows start](https://github.com/rea-gith/rea/blob/main/win/Start.h): `win/Start.h`

### Other components

- **Engineer**
- **Local target**

## Connections

- Engineer → CLI setup: launches (evidence: `README.md`)
- Engineer → CLI runtime: runs (evidence: `README.md`)
- CLI runtime → Agent runtime: starts MCP
- Agent runtime → Local target: connects locally
- Agent runtime → Native helpers: uses helpers
- Native helpers → Ghidra hook: hooks
- Native helpers → Hopper hook: hooks
- Native helpers → IDA hook: hooks
- Agent runtime → JS handling: uses JS path
- JS handling → Electron handling: handles Electron
- JS handling → Browser WebMCP: handles browser
- CLI runtime → JSON streaming: streams JSON
- Engineer → Windows host: runs on Windows (evidence: `README.md`)
