# I Used REA to Clone OpenAI's Codex Channel: SoftsWeb Video: https://www.youtube.com/watch?v=pX8Sy8Rd44U Duration: 9 min Language: English Words: 1528 Transcript page: https://viewrankai.com/tools/youtube-transcript/pX8Sy8Rd44U --- [0:00] This is OpenAI's Codex, the coding agent that got downloaded more than 24 million times just last week. And this one next to it is a copy that an AI built using Ria, the open-source reverse engineering tool that has become one of the fastest-growing repos on GitHub. The AI had nothing to work from except the files Codex installs on your computer with no source code, and I'm about to give both programs the same task. [music] So, watch closely because by the end of this video, you'll know exactly how that copy got made and why it happened in a way I really didn't [0:32] expect. I told the agent to use Ria, but the first time it skipped it. So, I ran it again and forced it to use it. Then, I tested the copy against the real Codex with harder tasks, and it only matched 75% of the time. So, here's the whole story from the first look inside the file to the hidden tests the copy had never seen, including [0:53] the moment Ria completely failed. I covered Ria a couple of days ago at 150,000 stars, and now it's past 250,000. If you haven't watched that video yet, go check it out first and then come back to this one. Codex is really two things: an AI model on OpenAI's servers and a program on your computer, and only that program can be copied. I picked it because it's open-source, so taking it apart is legal and because the original gives me a real answer to grade the copy against. I'm not doing this to Cursor or Cloud Code because their terms forbid it, and [1:30] that's a line I don't want to cross. Here's the rule of the game. If you can't tell the two programs apart, the copy wins. The AI only gets the installed files, and the test stays hidden from it until the very end. So, let's start by looking inside the file. The first command shows a program with every function name deleted. So, a decompiler would see nothing but a wall of anonymous code. More than 4,000 of the strings are paths to the original source files, so the program carries its own table of contents. But, a program can't hide its text, and inside the file, there's a sentence that starts [2:03] with "You are Codex." followed by pages of instructions. The sandbox modes and the way it reads project rules are readable, too, before any special tool has even started. The tool names are in there, too, and so is a list of 11 built-in models, which looks boring now, but it's exactly what breaks the copy later. So, before any reverse engineering tool has run, the [2:26] file has already told us a lot. To hear Codex say it out loud, I wrote a tiny fake AI server that records every request and answers with whatever I script. Every request goes into a log, so I could read exactly what the real program says to the AI. The first surprise is that Codex works with any server you point it at. So, this whole [2:48] experiment cost me nothing to observe. That let me run the real program with no account and no API key, and when I typed "Just say hi." it sent over 20,000 characters of instructions before my words even appeared. Next, I made the fake AI ask for a command, and that showed how Codex reports results back with a wall time, an exit code, and the output, where one wrong character gives [3:11] the copy away. Then, I tried to break it on purpose with tools that don't exist and broken arguments. And every time it answered with one very specific message that a copy has to match. I also printed 6,000 lines and watched exactly where it cuts the output, a rule that's written down nowhere. So, I built a hidden test before the AI wrote a single line, because a copy that can see the test can cheat. I wrote it before touching the AI, so nobody can say I made the test fit the answer. It runs the real Codex and the copy on the same scripted tasks and compares everything they send and do, from the [3:50] instructions to the error messages. Every task runs 13 checks from the instructions and tool definitions to the files created, the error messages, and even the request headers. I even tested the test, and the real Codex scored a perfect 100 against itself. So, every point the copy loses is a real difference. That's what makes the whole [4:10] score trustworthy. Then I gave Claude Code the installed files, told it to rebuild the program in Python, and stayed out of the way. That's a copy of a 134 KB built from nothing but the installed files. 17 minutes and $2 later it was done, and out of 61 tool calls it had never once used the tool I gave it because watching the program from the outside was [4:34] quicker. Its own notes explain why it ran the original over and over against its own fake server and fixed every difference one by one. It worked ridiculously well. The copy scored 99% and I was ready to call it finished until I realized my test was too easy. And this is where the story takes a [4:52] turn. So, I read the list of things the AI admitted it couldn't recover and built a much harder test around exactly those gaps. The hard test has 25 tasks, one for each of the 11 models plus the default, the JSON events, images, goals, environment variables, headers, and server errors. The copy dropped to 75% and every known model failed because the real program sends different instructions and tools for each model name. That knowledge isn't something you can see with a simple prompt. It's a catalog hidden inside the file, and the AI had refused [5:30] to look there. So, this time using the tool was mandatory, and I installed Ghidra, the free decompiler from the NSA, to help it read the file. And I've got to be honest, the full analysis of a 294 MB program never finished. Five attempts in a row timed out and not one function was decompiled. What worked was a trick. The AI cut out the section that holds all the constants. And the tool opened that [6:00] small piece in seconds. That's worth remembering if you ever try this because when the big analysis gives up, a smaller piece of the file can still be enough. Inside it, the tool found the model catalog and the AI built it into the copy. So, every model name finally got the right instructions. It also found the exact warning Codex prints when its sandbox can't start and the names of the events in its JSON stream. And each one became code I could [6:27] check against the original. Most of the typing was still ordinary commands, 195 of them against 22 calls to the tool. But, those 22 calls were exactly what it was missing. None of that would have been found by watching the program from the outside. The second round took about 90 minutes and $14. And then I ran both tests again. On the hard test, the copy jumped from 75% to 98.5% and across both tests, it passed 416 of 422 checks. On the hard test, every one of the 11 model names now behaves [7:02] exactly like the real Codex. The copy still loses a few points. The real program rejects a tiny image that the copy accepts and the copy doesn't count the tokens used by a goal. That's 98.6% for a program the AI had only ever seen from the inside of a file. It still misses a few details. And the sandbox that protects your files doesn't work on my computer, so that part was never tested. And the copy has no screen or model, either. It's only the engine under the hood. So, remember the two screens at the start. The left one was the real Codex and the right one was the [7:36] copy. And if you couldn't tell them apart, that's the whole experiment. What this shows is that the secret of a program like this isn't in its code because the instructions are text, the tools are a list, and the behavior can be recorded. The tool didn't decompile anything for me, but it let the AI read exact bytes it could otherwise only guess about, and that was the difference [7:59] between 75% and 98%. An AI rebuilt the engine in a couple of hours for less than $18, which is why licenses matter and why I only used an Apache licensed program. The same trick works on any open source program. So, the only question is which one comes next. If you want to try it yourself, I will put the test, the fake AI server, and the notes on GitHub. So, tell me in the comments and tell me [8:26] which program you want taken apart next. Thanks for watching and see you next time. --- About this transcript Read from YouTube's own caption track and laid out by ViewRank AI (https://viewrankai.com). ViewRank AI finds the videos already beating a creator's own average on Instagram, TikTok and YouTube Shorts, transcribes them from the audio itself in more than 60 languages, and turns what worked into new ideas and scripts. Free transcript tools, no account needed: https://viewrankai.com/tools How to read any video this way: https://viewrankai.com/llms.txt