Back/Engineering/ChatGPT/Codex
BeginnerEngineering

How to Use OpenAI Codex to Understand and Modify a New Codebase

Open an unfamiliar repository in Codex, ask how to run it, launch the app with the returned command, and make a small behavior change in plain language while Codex traces the relevant code.

How to Use OpenAI Codex to Understand and Modify a New Codebase

Alex installs the Codex extension, asks how to play an unfamiliar game, runs the command Codex finds, and lowers an oversized jump with a plain language request.

Before you start

What you need

  • A local checkout of an unfamiliar repository
  • VS Code with the Codex extension
  • The dependencies required by the repository

What you’ll make

A locally running project plus one small, verified behavior change made through Codex.

Tools used

  • ChatGPT

    OpenAI conversational AI

    VisitChatGPT
  • Codex

    OpenAI's cloud-based AI software engineering agent that can execute code, run tests, and handle complex multi-file tasks autonomously.

    VisitCodex

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

3 steps

Step01

Set Up Codex in Your IDE

Install the Codex extension in VS Code, sign in, and open the repository folder. Keep the Codex panel beside the editor so you can ask questions while inspecting the files and terminal output.

For easier access, drag the Codex icon from the primary sidebar to the secondary sidebar on the right.

Step02

Ask for Setup Instructions

Ask Codex how to run the project instead of guessing from the file tree. Have it identify the package manager, setup command, and development command from the repository, then run those commands in the terminal.

Example prompt
Inspect this repository and tell me how to run it locally. Identify the package manager, required setup, environment files, and exact development command from the files in this repo. Then explain how I use the app once it starts.
Step03

Request a Change with Natural Language

Use the running app to choose one visible behavior, then describe the desired change in plain language. Let Codex locate the implementation, make the narrow edit, and run the relevant check. Return to the app and repeat the same interaction to confirm the result.

Example prompt
The character jumps much too high. Trace the code that controls jump height, lower it to a reasonable value without changing other movement behavior, and run the relevant checks. Summarize the file and value you changed.

What good looks like

  • Codex identifies the repository specific start command.
  • The application runs locally before the change is made.
  • The requested behavior changes without unrelated edits.
  • The same local interaction confirms the new behavior.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

The setup command fails
Give Codex the full terminal output and ask it to inspect the package scripts, lockfile, runtime version, and repository documentation before proposing the next command.
Codex edits the wrong code path
Describe the visible behavior and where it appears, then ask Codex to trace the event or component before changing code.
A small request produces a large diff
Ask Codex to revert unrelated edits and implement the smallest change that controls the observed behavior.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready