Rebuild something with REA
How to use a coding agent and REA to study software you don't have the source for, write down how it works, and build a new version from those notes. The steps are the same for an old game, a dead app or a closed file format.
1. Set up REA
REA ("Reverse Engineer Anything") is an open-source MCP server. It gives an agent such as Claude Code, Codex, Cursor or Gemini CLI tools to inspect software. Every finding comes back with its evidence, and the analysis runs on your machine.
You need Node.js 22.19+, 24.11+ or 26+, or Bun with bunx in place of npx. Then:
# Register REA with your agent(s) and install its workflow instructions
npx rea-agents setup # or: bunx rea-agents@latest setup
# Optional: install the CLI globally
npm install --global rea-agents
rea --help
Native binaries such as DOS and Windows EXEs, native mobile libraries and console executables need a disassembler that REA can drive: Ghidra (free), Hopper or IDA. JavaScript, Electron, WASM, .NET, Android APKs and websites work without one. The REA README lists the rest.
Only get REA from its official sources: themorluto/rearepository, rea.tools, or therea-agentsnpm package.
2. Start from what the original was built with
| Original | Where to start |
|---|---|
| Android APK (Java/Kotlin) | inspect_android_package, search_android_classes, inspect_android_method, decode_android_resources |
| Native EXE, ELF or Mach-O | binary_overview, list_procedures, procedure_pseudo_code, get_call_graph |
| .NET or Unity (Mono) | inspect_managed_artifact, inspect_managed_members |
| Web, Electron or HTML5 | analyze_javascript_application, analyze_web_bundle, recover_javascript_sources |
| Unknown container or data file | inspect_artifact, extract_artifact, list_strings, read_bytes |
3. Ask questions and write specs
Work one system at a time. Prompts that work well:
- "Using REA, find the main loop in this APK. What is the tick rate, and what does each tick update?"
- "Trace what happens when the user saves a file. Which checks run, and what is written?"
- "Work out the layout of this data file. Give me a table of the header fields and how entries are indexed."
- "List every network call at startup, and what the app does when each one fails."
- "Record anything you couldn't resolve as an unknown so we can come back to it."
Turn the answers into specs, one Markdown file per system. A spec describes behavior and formats: rules, timings, file layouts and edge cases. It cites the evidence behind each claim. Constants, struct layouts and format tables are fine to keep. Decompiled code is not.
4. Keep the rebuild clean-room
The classic method is the one Phoenix used for the PC BIOS in 1984. One team reads the original and writes a spec. A second team that has never seen the original writes new code from the spec. With agents:
- Agent A has REA and the original. It writes only specs and never code for the rebuild.
- Agent B gets only the specs, in a fresh session or a separate repository. It writes the new implementation.
- Keep both sets of output. The history of who saw what is your evidence that the code is new.
No court has yet ruled on whether an AI clean room counts the same as a human one. The chardet 7 dispute shows where the arguments are.
5. Verify against the original
Record the original's screenshots, input and output traces and save files, then compare the rebuild with them. REA's
capture and compare tools (capture_browser_scenario, compare_web_captures,
verify_reconstruction) help when both run somewhere REA can observe. For byte-exact work, the
tools in the list such as objdiff and decomp-permuter are the referee. The
DX-Ball reconstruction pairs REA with differential tests against the original x86 code.
6. Stay on the right side of rights holders
- "Abandonware" has no legal meaning. Copyright doesn't lapse when a game stops selling. Someone almost always still owns it.
- Specs and new code are yours. Rules and mechanics aren't protected. The original's art, sound, text, code and level designs are.
- Never host the original's files. Have players load assets from a copy they own, as OpenRCT2 and Ship of Harkinian do, or make new ones, as Freedoom did.
- Upscaling or tracing the original art is still the original art.
- Some games are genuinely free. Warzone 2100 and the ScummVM freeware titles were released by their owners. Check the licence they published.
This is general information, not legal advice.
7. Add it to the list
Once there is something public to look at, add your project.