Auto Re Agent reconstructs C/C++ functions from compiled binaries. It combines Ghidra program analysis with language models in a bounded autonomous loop: a reverser model writes a candidate implementation, an independent checker model reviews it, a structural verifier compares the candidate against binary evidence, configured build and test commands run against it, and a parity gate scores it. The output is candidate code in reports and overlays; the original source tree is never patched.
A reversal counts as successful only when four conditions hold: the checker returns PASS, the objective verifier finds no strong structural mismatch, candidate validation satisfies the configured acceptance policy, and parity is not blocked by the RED/YELLOW policy. This is conservative verification rather than a proof of semantic or binary equivalence.
Evidence comes through ghidra-ai-bridge, a separate package with a versioned JSON/CLI surface, leaving room for other backends. The reverser preloads a bounded evidence bundle — decompilation, cross-references in both directions, structs, enums, vtables, globals, strings, normalized high P-code, control-flow graphs, and nearby project source — and can request further read-only operations during an investigation. The bundle is also ingested into a persistent knowledge graph connecting functions, calls, globals, and strings.
Generated code is written to an overlay. With copyproject: true the project is copied to a temporary directory, the candidate replaces the matching body there, and build, test, and runtime commands run from that copy. Because those commands are arbitrary project-owned shell commands, they only count as acceptance evidence when trustconfigured_commands: true is set explicitly. A standalone re-agent parity command runs the same signals against functions already in the source tree, with semantic-rule files and manual overrides.
| Signal | Level | Description |
|---|---|---|
| Missing source | RED | No source body was found |
| Stub markers | RED | Source contains a configured stub marker |
| Trivial stub | RED | Small plugin-call-heavy body with no control flow |
| Large ASM, tiny source | RED | Large disassembly with a very small source body |
| Plugin-call heavy | YELLOW | Plugin calls dominate the source body |
| Short body | YELLOW | Body has fewer than six lines |
| Low call count | YELLOW | Decompiled callees greatly exceed source calls |
| FP sensitivity | YELLOW | Assembly has FP-sensitive operations but source has no math tokens |
| Call-count mismatch | YELLOW | Source and assembly call counts differ beyond the configured threshold |
| NaN logic | YELLOW | Decompile indicates NaN-sensitive behavior missing from source |
| Inline wrapper | INFO | Source forwards to an internal implementation |
Features
- Reverser and checker loop: two independently configurable models, with bounded review rounds, investigations, and attempts per function
- Ghidra evidence: decompilation, xrefs, structs, enums, vtables, globals, strings, normalized P-code, and CFGs through ghidra-ai-bridge
- Objective verifier: compares generated code with decompile, assembly, CFG, and P-code evidence, returning FAIL only on strong mismatches and UNKNOWN on thin evidence
- Candidate validation: build, test, and runtime gates run in a temporary project copy, gated behind an explicit trust flag
- Parity signals: 11 heuristic RED/YELLOW/INFO checks, with RED blocking by default and YELLOW optionally blocking
- Knowledge graph: reports/re-agent/knowledge-graph.json links functions, calls, globals, and strings across runs
- Provider choice: Claude API, a local authenticated Claude CLI, OpenAI-compatible APIs, and a local Codex CLI, selectable per role
- Project profiles: generic-cpp, windows-x64, gta-reversed, and openrct2 starting configurations
- Function selection: dependency-order, easiest-first, or high-impact strategies, run per address or per class with a function cap
