Day 1, 30 minutes · beginner
Why it matters
Codex is OpenAI's coding agent. You describe a job in plain words and Codex reads your files, edits them and runs commands to check its own work. It runs in several places, including the Codex CLI in your terminal, the ChatGPT desktop app and Codex Cloud on OpenAI's computers. This course starts in the terminal, because that is where you see most clearly what the agent does.
You will follow one small project through the whole course. Benthe runs Puffinreach Kites, a made-up kite shop, and wants a simple website with a price list that is always right. Over six lessons you hand that work to Codex in bigger and bigger pieces: first a single task, later a longer job in the cloud and a check that runs with nobody at the keyboard.
Today you install the Codex CLI, sign in with your ChatGPT account and give Codex its first real task. At the end you have a working one-page site in a git repository and you know where to look to see what Codex is allowed to do.
What you need
- A terminal and git. You should be able to open a terminal, go into a folder and paste a command. Run
git --versionto check that git is installed. - A ChatGPT plan that includes the Codex CLI. OpenAI's Codex pricing page lists the Codex CLI, Codex Cloud and the IDE extension for Plus, Pro, Business, Edu and Enterprise. For Free and Go it lists Codex in the desktop app only, subject to rollout. The help center says Codex is included in Free and Go too (usage limits vary by plan), so if you are on one of those plans you can try signing in before you pay. You can also sign in with an OpenAI API key, which is billed separately at API prices and does not include Codex Cloud.
- A supported country. The Netherlands is on OpenAI's list of supported countries for ChatGPT and the API.
A few words you will meet
- Repository (repo): a folder that git tracks, so every change can be seen and undone.
- Sandbox: the fence Codex works inside. By default, commands Codex runs can only write in your project folder and cannot use the internet.
- Approval policy: the rule for when Codex stops and asks you first.
- Slash command: a line that starts with
/, such as/status. It is a command for Codex itself, not a message to the model.
The steps
- Install the Codex CLI with the one-line installer for your system. The guide below has the exact command.
- Check the install in a new terminal window with
codex --version. - Make a git repository called
puffinreach-kites. This matters more than it looks. The Codex docs say Codex looks at whether a folder is under version control when it starts. In a git repository it recommends the Auto setting (edit files and run commands in the folder, ask before anything else). In a plain folder it recommends read-only. - Start Codex and sign in. Run
codexand choose to sign in with ChatGPT. Codex stores your login, so you do this once. - Look before you work.
/statusshows the model, the approval policy, which folders Codex may write in, and how much of the context window is used. - Give the first task with a goal, the context, limits and a clear "done when". The best practices guide names those four parts as a good default for every prompt.
- Review and save.
/diffshows every change, including new files git does not track yet. Then you check the page in your browser and commit it yourself.
Follow the guide for Codex below for the exact commands.
Why you commit, not Codex
The docs advise git checkpoints before and after every task, so you can always go back. In the default sandbox the .git folder is read-only for commands Codex runs, which is a protection. So today you make the commit yourself with two git commands. If git complains that it does not know your name and email, it prints the two commands to set them: run those once and commit again.
Example: Benthe's first task
Benthe pasted the task with the three kites and their prices. Codex showed each step as it went: it created prices.json, then index.html, then read both files back to compare the prices. /diff showed two new files. In the browser the Box Lantern said 49.50, the same as in prices.json. She committed with the message "First version of the site".
Common mistakes on day 1
- Starting Codex in your home folder. Codex works in the folder where you start it. Always
cdinto the project first. - Skipping
git init. Without git, Codex starts more cautiously and later lessons (such ascodex execin lesson 5) refuse to run. - A vague first prompt. "Make a website" leaves Codex guessing. Say what done looks like.
- Pasting the macOS line into PowerShell. Each system has its own install line.
Deeper dive
Today's actions
Ticks are not saved without an accountDo it in OpenAI Codex
OpenAI Codex
- On macOS or Linux, open a terminal, paste this line and press Enter.
curl -fsSL https://chatgpt.com/codex/install.sh | sh - On Windows, open a new PowerShell window, paste this line and press Enter. npm and Homebrew installs work too: see the notes.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" - Open a new terminal window and run
codex --version. A version number means the install worked. - Make the practice folder and turn it into a git repository. Run one line at a time.
mkdir puffinreach-kites cd puffinreach-kites git init - Run
codex. On the first start, choose Sign in with ChatGPT and finish the sign-in in the browser window that opens. If Codex asks whether you trust this folder, accept: you just made it. - Type
/statusand press Enter. Write down the model, the approval policy and the writable folders it shows. - Paste this task and press Enter. Read each step Codex shows while it works.
Build a one-page website for Puffinreach Kites, a small kite shop. Create index.html with the shop name, a short welcome, opening hours (Tuesday to Saturday, 10:00 to 17:00) and a price list. Create prices.json with three kites: Gull Delta 34.95, Box Lantern 49.50, Swift Stunt 79.00 (euros). The prices in index.html must match prices.json. Plain HTML and CSS only, no build tools, no other files. Done when both files exist and you have listed what you made. - Type
/diffto see the new files, then/exit. Open index.html in your browser, check the prices and commit withgit add -Aandgit commit -m "First version of the site".
Note: If the browser sign-in does not work, for example on a remote machine or when your network blocks the return to the terminal, run codex login --device-auth and enter the one-time code in your browser. Device code sign-in is a beta feature and must be switched on in your ChatGPT security settings first. codex login status shows how you are signed in. Other installs: npm install -g @openai/codex or brew install --cask codex.
Paid planOpenAI lists the Codex CLI for ChatGPT Plus, Pro, Business, Edu and Enterprise. Free and Go list Codex in the desktop app only, subject to rollout. An API key also works.
Create a free account to save your progress
Free, and no payment details. Your ticks and finished lessons are kept, on every device.
Create a free account I already have an accountCreate a free account to save your progress. Sign in or sign up