{"id":213,"date":"2026-11-09T18:43:30","date_gmt":"2026-11-09T14:43:30","guid":{"rendered":"https:\/\/demensdeum.com\/blog\/2026\/11\/09\/rea-opencode-guide\/"},"modified":"2026-11-09T19:37:58","modified_gmt":"2026-11-09T15:37:58","slug":"rea-opencode-guide","status":"publish","type":"post","link":"https:\/\/demensdeum.com\/blog\/2026\/11\/09\/rea-opencode-guide\/","title":{"rendered":"REA and OpenCode: installation and first investigation"},"content":{"rendered":"<p>REA (Reverse Engineer Anything) is an MCP server that allows you to reverse engineer software applications, binaries, and behavior in real time. The tool covers the path from application behavior to machine code, and it is convenient to use OpenCode as the agent that manages it.<\/p>\n<p>OpenCode is an open programming agent that lives in the terminal. It reads project files, edits code, runs commands and tests, and most importantly, it supports MCP out of the box, so REA connects to it directly.<\/p>\n<h2>What makes REA unique<\/h2>\n<p>REA stands out in the field of reverse engineering with comprehensive support for several platforms and types of analysis:<\/p>\n<ul>\n<li><b>Native binaries<\/b>: Hopper, Ghidra, IDA or Kuna for disassembly and decompilation<\/li>\n<li><b>JavaScript applications and Electron<\/b>: static analysis of Electron modules, imports and boundaries<\/li>\n<li><b>Managed Code<\/b>: Analyzing .NET Assemblies<\/li>\n<li><b>Real-time analysis<\/b>: monitoring process behavior<\/li>\n<li><b>Network traffic<\/b>: capture and analysis of HTTP\/S requests and responses<\/li>\n<li><b>Mobile applications<\/b>: analysis of APK and IPA files for Android and iOS<\/li>\n<li><b>Embedded software<\/b>: analysis of embedded systems and IoT devices<\/li>\n<li><b>Model files<\/b>: extracting GGUF and safetensors metadata<\/li>\n<li><b>GPU code objects<\/b>: analysis of CUDA and HIP kernels<\/li>\n<li><b>Saving games<\/b>: restoring game logic and executable files<\/li>\n<\/ul>\n<h2>Basic architecture and philosophy<\/h2>\n<p>REA follows a three-step research process that makes reverse engineering accessible to developers:<\/p>\n<ol>\n<li><b>Inspection<\/b>: REA connects to analysis tools and examines targets (binaries, applications, websites)<\/li>\n<li><b>Analysis<\/b>: traces through the code, determining rules and behavior<\/li>\n<li><b>Recovery<\/b>: the agent uses the results to explain behavior and build or test an implementation<\/li>\n<\/ol>\n<p>This process allows the AI \u200b\u200bagent to answer complex questions, such as: \u201cUnderstand how search works in the Notes app, show me the evidence, and create a similar feature for my project.\u201d<\/p>\n<h2>Practical examples of use<\/h2>\n<h3>1. Analysis of mobile applications<\/h3>\n<p>REA can analyze Android APK files for recovery:<\/p>\n<ul>\n<li>declarations and permissions in the manifest;<\/li>\n<li>class methods and dependencies;<\/li>\n<li>links to native libraries;<\/li>\n<li>network endpoints and data flows.<\/li>\n<\/ul>\n<p>For example, an analysis of Aegis Authenticator showed how six-digit authorization codes change every 30 seconds: it examined how time-based code generation (TOTP) works.<\/p>\n<h3>2. Desktop Application Function Extraction<\/h3>\n<p>Analysis of the % button in Windows Calculator demonstrates the capabilities of REA:<\/p>\n<ul>\n<li>define different behavior depending on the context (after + or \u00d7);<\/li>\n<li>parsing assembly instructions to understand the logic;<\/li>\n<li>extracting and explaining mathematical operations;<\/li>\n<li>restoring the rules: \u201cAfter +: 10% of the first number\u201d and \u201cAfter \u00d7: convert 10% to 0.1.\u201d<\/li>\n<\/ul>\n<h3>3. Restoring Web Application API<\/h3>\n<p>REA can record a browser session and reconstruct it as an RL environment where the AI \u200b\u200bagent performs tasks like working with folders without running the original application.<\/p>\n<h3>4. Restoring game logic<\/h3>\n<p>The DX-Ball case showed how REA restored the soundscape calculation from the 1996 Windows game by reverse-engineering C code that runs through 3,205 test cases and matches the original compiled code.<\/p>\n<h2>Technical capabilities<\/h2>\n<h3>Native analysis<\/h3>\n<ul>\n<li>Works with Hopper, Ghidra, IDA or Kuna for deep binary file analysis<\/li>\n<li>Supports ELF, PE, Mach-O and other executable file formats<\/li>\n<li>Extracts pseudocode, assembler, symbols and calls<\/li>\n<li>Performs offline analysis without having to launch the original tools<\/li>\n<\/ul>\n<h3>JavaScript Analysis<\/h3>\n<ul>\n<li>Analyzes Node.js and Electron applications<\/li>\n<li>Tracks module imports and dependencies<\/li>\n<li>Captures behavior in real time via a browser connection<\/li>\n<li>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 source maps \u0438 \u043c\u0438\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/li>\n<\/ul>\n<h3>Security<\/h3>\n<ul>\n<li>Static analysis of PE certificates (Authenticode)<\/li>\n<li>Analysis of defense mechanisms (PIE, NX, RELRO, CFG)<\/li>\n<li>Mapping imports and DLLs<\/li>\n<li>Analysis of crash reports (Apple IPS)<\/li>\n<\/ul>\n<h2>What does REA return<\/h2>\n<p>REA does not give the agent ready-made conclusions without reason. The result of each query is the findings along with the evidence on which they are based. Depending on the purpose, the response includes:<\/p>\n<ul>\n<li><b>Links to code<\/b> &#8211; specific files and lines where the function under study is implemented.<\/li>\n<li><b>Pseudocode and assembler<\/b> &#8211; for native binaries: decompiled functions, instructions and connections between calls.<\/li>\n<li><b>Application structure<\/b> &#8211; for JavaScript and Electron: modules, imports, routes, IPC and connections with native add-ons.<\/li>\n<li><b>Metadata and facts<\/b> &#8211; manifests, certificates, signatures, format headers and other static data.<\/li>\n<li><b>Restrictions<\/b> &#8211; places that could not be sorted out, with a note about what exactly remains unknown.<\/li>\n<\/ul>\n<p>The agent uses this data to explain behavior, answer clarifying questions, or assemble and test its implementation. It is the presence of evidence and explicit limitations that distinguishes an REA result from a simple guess of the model.<\/p>\n<h2>Before you begin<\/h2>\n<p>It is assumed that OpenCode is already installed and the model is connected to it. Node.js 22.23.4+, 24.22.1+ or 26.12.1+ is needed by REA itself, so check the version:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>node -v\n<\/code><\/pre>\n<\/div>\n<h2>Step 1: Connect REA to OpenCode<\/h2>\n<p>REA registers with OpenCode as an MCP server. Run in terminal:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx rea-agents@latest setup\n<\/code><\/pre>\n<\/div>\n<p>To directly specify OpenCode, use its identifier <code>opencode<\/code>:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx rea-agents@latest setup --client opencode\n<\/code><\/pre>\n<\/div>\n<p><b>What setup does:<\/b><\/p>\n<ul>\n<li>registers REA as an MCP server;<\/li>\n<li>adds workflow instructions;<\/li>\n<li>makes a backup copy of the existing configuration;<\/li>\n<li>asks for confirmation before applying changes.<\/li>\n<\/ul>\n<p><b>Important point:<\/b><br \/>\nFor the first experiment, you can skip the optional Hopper installation. After setup is complete, restart OpenCode: exit the session and run <code>opencode<\/code> again.<\/p>\n<p>Check the connection:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx -y rea-agents@latest doctor --client opencode --json\n<\/code><\/pre>\n<\/div>\n<p>Successful result: <code>\"healthy\": true<\/code>.<\/p>\n<p>Then ask the agent:<\/p>\n<blockquote><p>\u201cCheck that REA is connected and show me which REA tools you can use.\u201d<\/p><\/blockquote>\n<h2>Step 2: First investigation<\/h2>\n<p>REA can analyze applications without launching them.<\/p>\n<ol>\n<li><b>Download the example:<\/b>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>Download https:\/\/rea.tools\/examples\/notes-example.zip\n<\/code><\/pre>\n<\/div>\n<p>Unpack the archive into the <code>notes-example<\/code>.<\/li>\n<p> folder<\/p>\n<li><b>Give the agent a task:<\/b><br \/>\n<blockquote><p>\u201cUse REA to inspect the app at <code>\/absolute\/path\/to\/notes-example<\/code>. Find what happens when I click Export notes. Show where notes.csv is written, which fields it contains, and the relevant files and lines.\u201d<\/p><\/blockquote>\n<\/li>\n<\/ol>\n<p><b>Expected response:<\/b><\/p>\n<blockquote><p>\u201cThe button sends a <code>notes:export<\/code> message. The main process formats the notes as CSV and writes <code>notes.csv<\/code> in the user&#8217;s Downloads folder. The columns are <code>id<\/code> and <code>title<\/code>.\u201d<\/p><\/blockquote>\n<h2>Step 3: Ghidra installation and native analysis<\/h2>\n<p>To analyze native binaries (executables and libraries), REA uses an analysis provider. The most affordable free option is Ghidra from NSA. The tool is installed once on the computer where REA runs.<\/p>\n<h3>What you need<\/h3>\n<ul>\n<li>64-bit JDK 21 or later, including Java compiler (<code>javac<\/code>).<\/li>\n<li>Ghidra archive from the releases page.<\/li>\n<\/ul>\n<h3>Installation<\/h3>\n<ol>\n<li>Install 64-bit JDK 21 or later. Select a package for your computer architecture.<\/li>\n<li>Download Ghidra from the Assets list on the releases page and unzip the <code>ghidra_\u2026_PUBLIC_\u2026.zip<\/code> archive. Take the release archive, not the \u201cSource code.\u201d<\/li>\n<li>Find the unpacked folder that contains <code>ghidraRun<\/code> or <code>ghidraRun.bat<\/code>. This path will be needed for the <code>GHIDRA_INSTALL_DIR<\/code> variable.<\/li>\n<\/ol>\n<p>Check out Java. The first command prints <code>java.home<\/code> &#8211; this path is needed for <code>JAVA_HOME<\/code>. The second confirms that the compiler is installed:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>java -XshowSettings:properties -version\njavac -version\n<\/code><\/pre>\n<\/div>\n<h3>Ghidra connection<\/h3>\n<p><b>Windows (PowerShell):<\/b><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>$env:GHIDRA_INSTALL_DIR = \"C:\/tools\/ghidra_12.1.4_PUBLIC\"\n$env:JAVA_HOME = \"C:\/tools\/jdk-21\"\nnpx -y rea-agents@latest doctor --provider ghidra --json\nnpx -y rea-agents@latest setup\n<\/code><\/pre>\n<\/div>\n<p><b>macOS \/ Linux:<\/b><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>export GHIDRA_INSTALL_DIR=\"\/absolute\/path\/to\/ghidra_12.1.4_PUBLIC\"\nexport JAVA_HOME=\"\/absolute\/path\/to\/jdk-21\"\nnpx -y rea-agents@latest doctor --provider ghidra --json\nnpx -y rea-agents@latest setup\n<\/code><\/pre>\n<\/div>\n<p>Replace the paths with your own. Keep the commands in one terminal session: after setting the environment variables, re-run setup, confirm the configuration update and restart OpenCode.<\/p>\n<p>The provider check should return a successful report:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx -y rea-agents@latest doctor --provider ghidra --json\n<\/code><\/pre>\n<\/div>\n<h3>Native analysis example<\/h3>\n<p>Give the agent the full path to the executable file and specify the provider:<\/p>\n<blockquote><p>\u201cUse REA with a configured provider to explore <code>\/absolute\/path\/to\/program<\/code>. List the functions and lines, then explain the part that handles user input, with references to the code.&#8221;<\/p><\/blockquote>\n<p>Or run the command directly from the terminal:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx -y rea-agents@latest function \"\/absolute\/path\/to\/program\" main --provider ghidra --json\n<\/code><\/pre>\n<\/div>\n<p>Replace <code>main<\/code> with the function name or address from the target program&#8217;s list of functions. The result contains pseudocode, assembler, and references between calls.<\/p>\n<h2>Analysis of another type of software<\/h2>\n<p>Select target software category:<\/p>\n<ul>\n<li><b>JavaScript \/ Electron<\/b> &#8211; requires Node.js and npm. <a href=\"https:\/\/rea.tools\/guides\/javascript\/\">Guide<\/a>.<\/li>\n<li><b>Websites<\/b> &#8211; Requires Chrome, Chromium or Edge browser. <a href=\"https:\/\/rea.tools\/guides\/browser\/\">Guide<\/a>.<\/li>\n<li><b>Android APK<\/b> &#8211; requires JADX and JDK 17+. <a href=\"https:\/\/github.com\/morluto\/rea\/blob\/main\/docs\/android-analysis.md\">Manual<\/a>.<\/li>\n<li><b>Native executables<\/b> &#8211; requires Hopper, Ghidra or IDA. <a href=\"https:\/\/rea.tools\/guides\/native\/\">Guide<\/a>.<\/li>\n<li><b>.NET assemblies<\/b> &#8211; requires Node.js and npm. <a href=\"https:\/\/github.com\/morluto\/rea\/blob\/main\/docs\/managed-code-analysis.md\">Manual<\/a>.<\/li>\n<\/ul>\n<h2>Using REA from the terminal<\/h2>\n<h3>Static analysis of JavaScript\/Electron application<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx -y rea-agents@latest analyze-javascript-application \"\/absolute\/path\/to\/app\" --json\n<\/code><\/pre>\n<\/div>\n<p><i>Replace the path with the folder with the application or .asar file.<\/i><\/p>\n<p><b>Where to find the Electron application .asar file:<\/b><\/p>\n<ul>\n<li><b>Windows:<\/b> <code>C:\\Users\\&lt;you&gt;\\AppData\\Local\\Programs\\&lt;App&gt;\\resources\\app.asar<\/code><\/li>\n<li><b>macOS:<\/b> <code>\/Applications\/&lt;App&gt;.app\/Contents\/Resources\/app.asar<\/code><\/li>\n<li><b>Linux:<\/b> <code>\/opt\/&lt;App&gt;\/resources\/app.asar<\/code><\/li>\n<\/ul>\n<h3>Global installation of the rea command<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npm install --global rea-agents\n<\/code><\/pre>\n<\/div>\n<p>After this, the <code>rea --help<\/code> command is available.<\/p>\n<h3>Installation via curl (macOS \/ Linux)<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>curl -fsSL https:\/\/raw.githubusercontent.com\/morluto\/rea\/main\/install.sh | bash\n<\/code><\/pre>\n<\/div>\n<p>After installation, follow the instructions to configure the agent. If the setup menu does not appear, run <code>rea setup<\/code>.<\/p>\n<h2>Update and delete<\/h2>\n<h3>REA update<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx rea-agents@latest setup\n<\/code><\/pre>\n<\/div>\n<p><i>For global installation: <code>rea update<\/code><\/i><\/p>\n<h3>Removing REA<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx rea-agents@latest uninstall\n<\/code><\/pre>\n<\/div>\n<h2>Getting help<\/h2>\n<ul>\n<li><b>FAQ<\/b>: <a href=\"https:\/\/rea.tools\/faq\/\">rea.tools\/faq\/<\/a> &#8211; quick answers about updates, agents and analysis<\/li>\n<li><b>Guides<\/b>: <a href=\"https:\/\/rea.tools\/guides\/\">rea.tools\/guides\/<\/a> &#8211; examples for binary, Electron and browser analysis<\/li>\n<li><b>GitHub Issues<\/b>: <a href=\"https:\/\/github.com\/morluto\/rea\/issues\">github.com\/morluto\/rea\/issues<\/a> &#8211; report an issue<\/li>\n<li><b>Discord<\/b>: <a href=\"https:\/\/discord.gg\/GkcryMnJDM\">discord.gg\/GkcryMnJDM<\/a> &#8211; questions, investigations and work in progress<\/li>\n<\/ul>\n<h2>Typical problems<\/h2>\n<h3>OpenCode does not see REA<\/h3>\n<p>Restart OpenCode after setup. Use the <code>doctor<\/code> command to test the connection:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx -y rea-agents@latest doctor --client opencode --json\n<\/code><\/pre>\n<\/div>\n<h3>The provider requires configuration<\/h3>\n<p>For Ghidra run:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npx -y rea-agents@latest doctor --provider ghidra --json\n<\/code><\/pre>\n<\/div>\n<p>The report will show the failed test and the suggested next step.<\/p>\n<h3>Windows, WSL and paths with spaces<\/h3>\n<ul>\n<li>Use PowerShell for Windows clients<\/li>\n<li>If the agent is running inside WSL, install Node.js and REA inside that Linux system and use the Linux paths<\/li>\n<li>In the terminal, enclose paths with spaces in quotes<\/li>\n<\/ul>\n<h3>Setting up Hopper on macOS<\/h3>\n<p>If macOS asks you to allow Automation, allow the app that runs REA in System Preferences: System Preferences \u2192 Privacy &#038; Security \u2192 Automation, then try again.<\/p>\n<h2>Links<\/h2>\n<p><a href=\"https:\/\/github.com\/morluto\/rea\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/morluto\/rea<\/a><br \/>\n<a href=\"https:\/\/rea.tools\/\" rel=\"noopener\" target=\"_blank\">https:\/\/rea.tools\/<\/a><br \/>\n<a href=\"https:\/\/rea.tools\/get-started\/\" rel=\"noopener\" target=\"_blank\">https:\/\/rea.tools\/get-started\/<\/a><br \/>\n<a href=\"https:\/\/rea.tools\/guides\/\" rel=\"noopener\" target=\"_blank\">https:\/\/rea.tools\/guides\/<\/a><br \/>\n<a href=\"https:\/\/opencode.ai\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/<\/a><br \/>\n<a href=\"https:\/\/opencode.ai\/docs\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/docs\/<\/a><br \/>\n<a href=\"https:\/\/opencode.ai\/docs\/mcp-servers\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/docs\/mcp-servers\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>REA (Reverse Engineer Anything) is an MCP server that allows you to reverse engineer software applications, binaries, and behavior in real time. The tool covers the path from application behavior to machine code, and it is convenient to use OpenCode as the agent that manages it. OpenCode is an open programming agent that lives in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-software"],"translation":{"provider":"WPGlobus","version":"3.0.6","language":"en","enabled_languages":["en","ru","zh","de","ja","fr","es","pt","hi"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"ru":{"title":true,"content":true,"excerpt":false},"zh":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false},"ja":{"title":true,"content":true,"excerpt":false},"fr":{"title":true,"content":true,"excerpt":false},"es":{"title":true,"content":true,"excerpt":false},"pt":{"title":true,"content":true,"excerpt":false},"hi":{"title":true,"content":true,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":1,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":214,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/213\/revisions\/214"}],"wp:attachment":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}