Skip to content
howdoaiagentswork.com

REA: How AI Agents Reverse Engineer Software

REA connects AI agents to Ghidra, IDA, and Hopper via MCP

What REA is (and isn't)

REA (Reverse Engineer Anything) is an open-source MCP server and CLI published as the npm package rea-agents, MIT-licensed, written in TypeScript. It is maintained by the developer morluto and lives at github.com/morluto/rea.

REA is not a disassembler or a decompiler. It does not ship its own analysis engine. What it does is wrap existing tools — Ghidra, IDA, Hopper, JADX, Binwalk, and others — into a standardized interface that an AI agent can call through the Model Context Protocol. The agent asks a question in natural language; REA routes the request to the right backend, runs the analysis locally, and returns structured evidence the agent can reason over.

Installation is one command: npx rea-agents setup. It registers REA as a toolset for MCP-compatible agents — Claude Code, Cursor, Codex, Gemini CLI, and GitHub Copilot CLI — by injecting workflow instructions into the agent's configuration.

The three-layer architecture

REA's codebase splits into three layers, each with a single responsibility:

LayerDirectoryWhat it does
Domainsrc/domain/Defines what counts as "evidence" and an "analysis target."
Applicationsrc/application/Plans the task: "decompile this function, then trace its callers."
Providerssrc/hopper/, src/browser/, …The execution layer. Calls Hopper, hooks the browser, runs JADX.

The Provider layer is swappable. If you switch from Hopper to IDA, you replace the Provider interface; the Domain and Application layers do not change. All tool invocations are declared in toolContracts.ts, which the agent reads to learn what it can call.

The request-investigate-verify loop

REA's core methodology is a request-investigate-verify cycle:

  1. Request: The agent issues a natural-language instruction — for example, "analyze how this Electron app's login feature is implemented."
  2. Investigate: REA selects the appropriate Provider (static JavaScript analysis, no native engine needed for Electron) and runs the analysis locally. The target file does not leave the machine.
  3. Verify: REA returns structured evidence — file offsets, assembly instructions, dependency graphs, pseudocode — with confidence labels. The agent reasons over this evidence, not over its own prior knowledge of what the code "probably" does.

The loop is conversational. An agent can start with an overview, then trace strings, follow cross-references, map the call graph, and finally extract pseudocode to reconstruct a specific function. Each step produces evidence the next step builds on.

Four evidence tiers

Every conclusion REA returns is classified into one of four tiers, and each carries an independent citation number linking back to the tool output that produced it:

TierMeaning
ObservedThe tool directly produced this output (a byte offset, an instruction, a string).
InferredA logical derivation from observed evidence (e.g., "this function calls that function").
SpeculativeA plausible but unconfirmed hypothesis.
UnknownThe analysis could not resolve this question.

The agent's explanation must attach evidence citations. A conclusion without a citation is not allowed. This is the mechanism that separates REA from asking a model to "guess what this binary does."

What REA can analyze

REA routes to different Providers based on the target type:

TargetBackendExtra engine?
Native binaries (ELF, PE, Mach-O)Ghidra, Hopper, or IDAYes — one of these must be installed
JavaScript / Electron appsStatic analysis (ASAR unpack, module graph, IPC tracing)No
.NET assembliesCIL instruction analysisNo
Android APKsJADX + adbJADX (adb for device interaction)
EVM bytecodeDispatch selector + mutability inferenceNo
Firmware / WASM / SQLiteBinwalk / UnblobDepends on target

Read-only by design

REA enforces a strict read-only posture on the tools it drives:

This connects to a broader agent-safety principle: the tools an agent drives should default to the least destructive operation that still answers the question. REA's read-only constraint is the same idea applied to reverse engineering — the agent can inspect, but it cannot alter the evidence it is reasoning over. For the wider argument about keeping agents on a leash, see how to put AI agents on a leash.

Why evidence beats guessing

The alternative to REA is to hand an agent a disassembler and let it figure things out. In practice that looks like this: you give the model a filename and it guesses the function from the name; you ask it how a memory region flows and it produces a confident answer with no source. Traditional retrieval-augmented generation (RAG) fares no better against obfuscated code — it retrieves text that looks similar, not evidence about the specific bytes in front of it.

REA's answer is to make the agent's claims grounded. When REA returns a conclusion, it returns the byte offset, the assembly instruction, or the dependency edge that justifies it. The model is not asked to recall what a function "probably" does; it is asked to explain what the tool actually observed. A hallucination about a binary is not a creative-writing failure — it is a factual error with a citation that can be checked.

Three public cases illustrate the difference:

In each case, the output is a reimplementation of verified behavior, not a guess about what the original code looked like.

What REA cannot do

Bottom line

REA's mechanism is not "AI that reverse engineers" — it is an evidence pipeline that forces an agent's reasoning to be grounded in what the tools actually observed. The three-layer architecture keeps the tool layer swappable; the four-tier evidence system keeps the agent honest; the read-only constraint keeps the target safe. For software interoperability, preservation, and security research, that is the difference between a model that guesses and one that shows its work.

Related: What is an MCP server · AI agent security · Verify AI-generated code · How to put agents on a leash · DeepSeek Harness · DeepInfer · How agents learn to use tools

Next Steps

Learn how MCP servers work →Read about AI agent security →Learn how AI agents work →

how do AI agents work — return to the complete AI agent architecture guide.

Was this helpful?

Your feedback stays on this page — no tracking.

Share this page