500B Tokens in AI Decompilation: A Deep Dive
A deep dive into the process of using AI to decompile a first-person shooter game, highlighting the challenges, optimizations, and learnings from the project.
Project Overview
The author spent three months and 500B tokens decompiling a popular first-person shooter game. The goal was not just a proof-of-concept but an accurate, stable, and feature-complete recreation.
The project involved AI orchestration and infrastructure optimization to achieve optimal results. The author collaborated with a community team, including RektInator, Future, st0rm, and others.
Decompilation Goals
The decompilation aimed to convert the game to C++, ensuring semantic correctness, readability, and security. The project also sought to improve portability, enabling the game to run on various platforms.
The main objective was to learn how to orchestrate autonomous AI agents effectively over an extended period.
AI Agents and Tools
The project utilized Claude Max (20x), Codex Pro, and various models like Sonnet 5, Opus 5.5, Luna, Sol, and Terra. Agents operated through Claude Code CLI and Codex CLI, communicating via Discord.
GitHub CLI was used for issue management, with one issue per translation unit. The agents were able to decompile about 80% of the game.
Optimization Efforts
The team optimized token consumption by adjusting compaction thresholds and managing volatile information during decompilation.
They also addressed agent focus and productivity issues, implementing a document for instructions and a cron job to keep agents aligned.
Challenges and Solutions
Despite progress, the decompilation faced quality issues, including semantic errors and architectural changes. To address this, the team introduced a byte-matching decompilation script using the original game's compiler.
This script allowed for automated verification and improved the accuracy of the decompilation process.
“Precise instructions are necessary. Agents have the desire to cheat if the assignment leaves room for interpretation.”
— Author