TH04 bounded reconstruction
Read AGENTS.md, docs/RE_HANDOFF.md, docs/ARCHITECTURE.md,
docs/RE_WORKFLOW.md, and docs/ORACLES.md completely before changing state.
Preflight
Run python3 scripts/preflight.py. Attest the analysis database against the
selected manifest target, including MZ CS:IP, relocation count, load-module
digest, and sampled bytes. Stop target-dependent work if attestation fails.
Recover one unit
- Identify artifact plus segment:offset and record a bounded candidate.
- Reconcile entries, exits, shared tails, far/near edges, jump tables, interleaved data, relocation sites, padding, and adjacent ownership.
- Inspect target-local callers, callees, xrefs, strings, ports, interrupts, globals, and disassembly before accepting a semantic name.
- Separate observed facts, compiler evidence, runtime evidence, ReC98 or adjacent-game corroboration, and inference. Quarantine all upstream source and statuses as candidates; never inherit an upstream exact/finalized claim.
- Recover memory model, calling convention, widths, packing, segment/group, side effects, and x87 behavior before selecting C/C++ shape.
- Implement natural source; no pseudocode paste, target-byte arrays, fake returns, inert padding, ABI lies, or unexplained assembly.
- Update source presence and evidence without claiming exactness.
- Hand byte work to
$th04-matching; use$th04-oraclefor ambiguous claims and$th04-runtimefor behavioral validation.
Keep databases and raw decompiler output under .analysis/. Durable facts
belong in source, ledgers, focused notes, or reproducible probes.