Folder check, scope, files, proof, and stop rule
After this, you'll be able to confirm which folder Codex is working in, then give it a coding task with scope, file boundaries, proof commands, and a clear stop rule.
Complete Choose the right Codex surface first.
Codex can only work in the folder you actually opened. Not the one you meant. A bad run often starts with the wrong folder or a branch nobody checked.
So the first line of every brief is a question, not a task.
Step 1: ask Codex which folder it sees. Ask: Which folder and branch are you in, and which files have uncommitted changes? Codex answers in plain words, so you never have to type a command.
Three words in that question. The working folder is the folder Codex is acting in.
A branch is a named line of work, so changes can be tried without touching the main version. Uncommitted files are ones changed but not yet saved into a commit.
A reply might look like this: I'm in the cafe-site folder on branch menu-update, with two files that have uncommitted changes: package.json and README.md. I'll leave both alone. Here package.json is the file that lists a project's add-on packages.
Read the answer before you go on. Is that the folder you meant, not a parent folder holding several unrelated apps?
Is it the branch you want changed? Are the uncommitted files ones Codex should leave alone?
If any answer is wrong, fix it first. In the app, use Choose project and pick the right folder. Only if you use the terminal version: start Codex from inside that folder.
Step 2: write the brief. Codex does better work when the brief names the finish line. A vague ask like "fix the dashboard" leaves Codex guessing the scope, the risk, and the proof all at once.
No proof, no accepting the change.
A brief has four parts. Scope says what outcome you want, and bounds say which files are in play. Proof says what check has to pass: a command (a line of text Codex types to run an automatic check) that reports no errors, or a page you can open and see working.
The stop rule says when Codex should pause and ask. That keeps Codex from fixing the right thing in the wrong file, or sneaking in cleanup nobody asked for.
Good brief:
What this actually looks like
Fix the save button on the profile page. Start in src/app/profile and src/lib/profile. Do not touch billing. Run npm test -- profile and npm run build. Stop if the fix requires a database migration.
Here is what those lines mean. A path like src/app/profile is a folder's address inside the project.
npm test runs the project's automatic checks, and npm run build checks that the site still assembles. A migration is a change to how saved data is structured, which is risky to undo.
Don't know your project's paths or commands? Ask Codex: Which commands does this project use to test and build, and which folders hold the profile page? If the project has no tests at all, name a page check instead, such as "open the profile page and confirm the name saves."
A project with several apps in one repo is where the wrong folder bites hardest. A folder can look like the app and still be missing the project's saved commands. Name the target so Codex does not adapt to the wrong one.
Build your practice project (once, about 5 minutes). The later lessons need something Codex can change and check, and this one needs nothing installed. In your codex-practice project, paste:
What this actually looks like
Build a tiny practice site here. Make one file, index.html, with a page title, a heading that says "Codex practice" and one short paragraph. Then make one simple check I can run by asking you: it confirms index.html has a title and a heading (any wording, so you can change the words later). Use only tools already on this computer. If you would need to install anything, stop and tell me first. Then run the check and show me the result.
Done means Codex reports the check passed, and you can open index.html in your web browser and see the page. If Codex says it needs something installed, ask it what and why, then approve once or ask for a plainer check. The lessons call this the practice site and its check.
In Claude Code and Antigravity: Claude Code starts in the folder where you run claude, and Antigravity works in the project folder you open. The same check applies: ask the agent which folder it is working in before the first task. The four-part brief works in all three tools.
Now Codex has a task it can finish and you can review. Check the folder, then state the proof, or the task isn't ready for Codex to touch alone.
Paste this into Codex
Rewrite this rough request into a Codex task brief. First ask Codex: Which folder and branch are you in, and which files have uncommitted changes? Paste its answer on the first line. Folder check: [paste Codex's answer. If the branch is main on a real project and you didn't expect that, ask Codex to make a new branch first. On the practice folder, main is fine.] Rough request: [paste your vague coding ask] Known files or route: [paste any known path, a route (one page address, like /booking), or write unknown] Do not touch: [paths, APIs (how one program talks to another), auth (sign-in code), secrets, data, or none] Proof I can run: [test, build, page, screenshot, or unknown] Stop if: [condition that should trigger a question] Return: 1. A one-paragraph Codex brief that starts with the folder check. 2. A file boundary. 3. A proof list. 4. One stop rule. No project of your own? Use the practice site: change its heading, name index.html as the file, and give "run the check and open index.html" as the proof. If you wrote unknown for files or proof, make the first task a read-only look (Codex reads and reports, changing nothing). The next lessons show how.
What a good response looks like
Folder check: I'm in codex-practice on branch main, and nothing is uncommitted. index.html and the check file are the only files. Brief: Change the heading in index.html from "Codex practice" to "Hello from Codex practice". Work only in index.html and leave the check file alone. Proof: run the check and show me it passing, then I will open index.html in my browser and read the new heading. Stop and ask if the check needs anything installed, or if the change would touch any other file.
Check yours against
Use Codex to help you confirm which folder Codex is working in, then give it a coding task with scope, file boundaries, proof commands, and a clear stop rule. Start with the exercise prompt and your real input. Ask for one draft, then check it against this proof: You asked which folder and branch Codex sees before writing the task. Accept only the version you can verify yourself.
You can ask Codex which folder and branch it sees, and read the answer
Pulling this out of your own head now is the part that actually moves it into long-term memory. Re-reading only feels like it does.
Think of a change you'd want Codex to make on your own project, not the one from the exercise. Write the brief in four lines: the outcome, what not to touch, how it proves the work, and when it stops to ask.
One good answer: 'Outcome: add a phone field to my florist's order form. Do not touch: the payment page. Proof: run the order form test and show it passing. Stop and ask if the field needs a new service.' If your stop line names a situation, not 'be careful', that works.
A Codex brief starts with a folder check and is a contract. It tells Codex where to work, how to prove it, and when to stop.