Breaking the Black Box: How REA is Transforming Reverse Engineering with AI

Every developer eventually hits the "impenetrable wall." You are deep into a project, a feature is behaving in an inexplicable manner, and the underlying logic is hidden behind a compiled binary or a labyrinthine mess of minified JavaScript. Traditionally, the solution required hours of tedious labor in disassemblers like Ghidra or IDA, demanding a specialized skill set—reverse engineering—that few modern developers have the time to master. Consequently, most simply guess, patch together a workaround, or abandon the investigation entirely.

Enter REA (Reverse Engineer Anything), an open-source Model Context Protocol (MCP) server designed to dismantle that wall. By bridging the gap between plain-language human intent and complex binary analysis, REA allows AI coding agents to inspect native binaries, Electron applications, Android APKs, .NET assemblies, and firmware. The promise is simple: you ask how a piece of software works, and the agent digs into the machine code to provide evidence.

But in an era of "hallucinating" AI, can we trust the machine’s interpretation of a binary? To test this, we put REA to the ultimate trial: reverse engineering the proprietary search-ranking algorithm of the popular note-taking app, Obsidian.

Reverse Engineer Anything (REA): Can AI Really Crack Closed Code?

The Chronology of an Investigation

Phase 1: Predicting the "Black Box"

Before invoking any AI, we performed a 15-minute "behavioral audit" of Obsidian 1.14.4 on macOS. We created a "throwaway" vault containing a specific set of filenames engineered to test how the application’s quick-switcher ranks fuzzy matches.

By observing search results for queries like "graph" and "gq," we manually derived a hypothesis. We noted that contiguous matches outranked fragmented ones, and that starting a word was significantly more valuable than matching mid-word. We established a tiered-sort model, predicting that a "boundary hit" was worth roughly 3 to 10 positions in the ranking. This empirical record would serve as our "ground truth" to verify the AI’s findings later.

Phase 2: Deploying REA

With the prediction recorded, we initiated the REA setup. Installation is a straightforward affair for Node 22+ users via npx rea-agents setup. The tool automatically configures your preferred AI coding assistant—be it Claude Code, Cursor, or the Gemini CLI—and registers the MCP server.

Reverse Engineer Anything (REA): Can AI Really Crack Closed Code?

We provided the agent with a broad, non-leading prompt: "Obsidian is installed at /Applications/Obsidian.app. Work out how its quick-switcher scores and ranks fuzzy matches. Show me the evidence for each step."

Phase 3: The Deep Dive

The agent immediately demonstrated its value by bypassing the "Electron shim"—the 472KB bootstrap file that often confuses automated scanners—and identifying the core 27MB obsidian.asar archive. Once extracted, the agent navigated the 3.9MB minified app.js.

Rather than using brute force, the agent leveraged the app’s public API. Because Obsidian exposes prepareFuzzySearch for plugin developers, those function names remained intact despite minification. By tracing the references of these public functions to their internal, obfuscated counterparts, the agent successfully isolated the exact scoring function, cx.

Reverse Engineer Anything (REA): Can AI Really Crack Closed Code?

Supporting Data: Decoding the Logic

The agent identified that the algorithm does not rely on a simple list-sort, but a complex, weighted numeric scoring system. The function cx applies a series of penalties to a baseline score:

  • Fragment Penalty: -1.0 per extra fragment.
  • Boundary Miss: -0.1 per mid-word character.
  • Span Penalty: -0.01 per character between the first and last match.
  • Lateness Penalty: -0.001 per character of offset.
  • Length Penalty: -0.0001 per total filename length.

Our manual prediction—that a boundary hit was worth 10 positions—was confirmed with mathematical precision. The agent’s analysis even uncovered "hidden" mechanics we hadn’t observed, such as a path-wrapper that applies a 1.0 penalty if the search falls back from a filename match to a full-path match, and a 10.0 penalty for files hidden in ignored directories.

Investigation Metrics

The efficiency of this approach is stark:

Reverse Engineer Anything (REA): Can AI Really Crack Closed Code?
  • Wall-clock time: 7 minutes and 8 seconds.
  • Total Cost: $1.83.
  • Token Usage: 97% of the 2.9 million cached tokens were reused, proving that prompt caching is the critical enabler for cost-effective agentic analysis.

Implications for Software Development

The emergence of REA signifies a paradigm shift in how we interact with proprietary software.

The Verification Requirement

The most significant implication is the necessity of "checkability." REA is not a magic wand; it is a force multiplier for a developer’s own analytical capabilities. The risk of "confident hallucination" remains. As seen in our test, while the agent correctly identified the algorithm, the written prose contained an off-by-one ambiguity in the span term. Had we not verified the code against the empirical data table we built in Phase 1, we might have implemented a flawed replica.

Legal and Ethical Boundaries

Reverse engineering, while technically facilitated by tools like REA, remains governed by strict legal frameworks. REA’s creators emphasize that the tool is intended for lawful research, interoperability, and analysis of software you are authorized to examine. Developers must distinguish between understanding an algorithm and reimplementing it. The latter carries significant intellectual property implications and should never be undertaken without legal counsel.

Reverse Engineer Anything (REA): Can AI Really Crack Closed Code?

The Death of "Hidden" Logic

For software vendors, the implications are profound. Security through obscurity is effectively dead. If an AI agent can, in seven minutes, deconstruct a proprietary ranking algorithm with 99% accuracy, the protection of intellectual property must shift from code obfuscation to robust, server-side logic and patented architecture that cannot be inferred from client-side binaries.


Conclusion: A New Standard for Debugging

The takeaway from our experiment is not that AI has replaced the reverse engineer. Rather, it has moved the baseline. The "transferable lesson" is that developers must form testable hypotheses before letting an agent touch their code.

By performing a behavioral audit first, you transform the AI from a potential source of misinformation into a verification engine. You no longer have to wonder if the agent is "telling the truth"—you have a set of empirical data points that either confirm or invalidate its findings.

Reverse Engineer Anything (REA): Can AI Really Crack Closed Code?

As AI agents continue to evolve, tools like REA will become standard issue in the developer’s toolkit. They allow us to peer into the black box, not with the arrogance of believing we know everything, but with the systematic rigor required to verify what the machine claims to have found. In the race to build better software, the ability to rapidly understand existing systems—lawfully and accurately—is perhaps the greatest competitive advantage a developer can possess.