01 / 10Foundation36 min lesson + lab

Start From Zero and Choose the Right Surface

Start even if you do not have a project yet: learn the terminal, create or open a tiny Git project, choose the right Codex surface, recover from common setup failures, and finish one verified task.

By the end

A working starter repository, a plain-language map of the app, CLI, IDE extension, and cloud, and one completed task whose environment and evidence are explicit.

01

Codex is a worker with tools

Codex can do more than generate an answer. Depending on the surface and permissions, it can inspect files, run commands, edit a project, search documentation, use connected services, operate a browser, and prepare reviewable artifacts. The practical consequence is simple: your request can affect a real environment. Supervise it like a capable teammate whose authority and finish line must be stated.

The durable mental model is an agent loop. Codex receives an objective, gathers relevant context, chooses an action, observes the result, and continues until it reaches a stopping condition or needs help. Buttons, mode names, and menu locations may change. The loop, the environment boundary, the permission boundary, and the need for verification are the concepts to learn for the long term.

  • Objective: the observable outcome you want, not merely an activity.
  • Context: the files, instructions, conversation, and connected data available to the task.
  • Tools: controlled ways to read, edit, execute, browse, or call another system.
  • Environment: the machine or hosted workspace where those tools act.
  • Receipt: evidence that the promised outcome happened in the named environment.
02

Four surfaces, four strengths

Use the desktop app when the work benefits from a project view, longer collaboration, files, visual artifacts, browser verification, or other connected capabilities. Use the CLI when the terminal and local repository are the center of the job. Use the IDE extension when active editor context and tight code review matter. Use cloud tasks when work should run in an isolated hosted environment or continue away from the local machine.

These are not four intelligence levels. They are four operating contexts. A task can be well executed on the wrong surface and still fail your goal because it touched the wrong copy, could not see a local dependency, or produced a cloud result that was never integrated. Choose based on location, tools, duration, review, and side effects rather than habit.

03

Read the terminal as a command-and-evidence conversation

A terminal shows a prompt, accepts a command, and prints output. The prompt usually includes the current folder; it is not part of the command you copy. Standard output is the normal result. Standard error contains warnings or failures. The exit status is a number programs use to report success: zero normally means success, while a non-zero value means the command failed or only partially completed.

Run one command at a time while learning. Read its output before continuing. `pwd` answers where you are, `ls` shows nearby files, `cd folder-name` moves into a folder, and `git status --short` shows changed files. If the terminal says `command not found`, the program is not installed or not on your PATH. If it says `not a git repository`, you are in the wrong folder or have not initialized Git yet.

  • Prompt: the terminal's invitation to type; do not copy its `$` or `%` marker.
  • Command: the instruction you type, such as `pwd` or `codex`.
  • Output: the evidence the command returns; copy the exact error when asking for help.
  • Current directory: the folder every relative path and local Codex task starts from.
  • Exit status: run `echo $?` immediately after a command when you need to confirm whether it succeeded.
04

No project yet? Create a tiny one before asking Codex to build

You do not need an existing application. Create a new folder, enter it, initialize Git, and add one README file. Git gives Codex a safer project boundary and gives you a history you can inspect or restore. Then launch `codex` from that folder and ask for one static page using only `index.html`, `styles.css`, and `script.js`. This avoids package managers, accounts, databases, and deployment while you learn the edit-review-run loop.

If a repository already exists online, clone it instead. `git clone` downloads a working copy, and `cd` moves into it. Before launching Codex, run `git status --short` and read the repository's README. In the desktop app, add or open the same project folder. In VS Code, Cursor, or Windsurf, open the folder and choose the Codex sidebar; the IDE extension can then use open files and selections as context.

05

Recover setup failures without random fixes

Treat an error as evidence. Copy the command, full error, current folder from `pwd`, and versions from `git --version` and `codex --version`. A missing `codex` command is an installation or PATH problem. An authentication prompt means the client needs sign-in. A Git error means either the folder is not a repository or Git is not installed. A dependency error in an existing app belongs to that project's documented setup, not to Codex itself.

Do not respond to setup friction by granting full access or pasting a credential into chat. First use `codex --help`, the official CLI page, and the repository's install instructions. If a command partly changed files, inspect `git status --short` before retrying. Preserve the failed output: it is the shortest path to a precise diagnosis.

06

Name the environment before the task

Before asking Codex to change anything, identify the project, repository, checkout, branch, and existing uncommitted changes. A checkout is one working copy of a repository. A branch is a named line of change history. Uncommitted changes are edits on disk that Git has not recorded. You do not need to master Git yet, but you must know whether another person's work is already present.

Also name the proof layer. Source proof means the intended code exists. Local-runtime proof means a process built from that source behaves correctly. Preview proof means a shareable temporary environment serves the result. Production proof means the real public or internal service is running that release. Never use one layer as shorthand for another.

07

Begin read-only, then make a reversible change

Start by asking Codex what the project does, where it starts, how it is tested, and which instructions govern work. Require paths or command output for the answer. This creates the habit of distinguishing evidence from plausible explanation before any source is touched.

Your first change should be narrow and easy to undo: correct one visible sentence, add one missing validation message, or adjust one small test fixture. Ask Codex to identify the intended files and verification step first. Then review the diff, run the check, and observe the result in the interface that matters.

08

Treat UI labels as navigation, not knowledge

Product interfaces change faster than engineering principles. A guide that says only which button to press will become stale. When a current label is useful, pair it with the durable job it performs: choose an environment, restrict authority, attach context, review a change, or collect proof.

Every chapter in this guide links to the current first-party documentation for exact UI and command details. If a screenshot and the live product disagree, follow the official current page and preserve the chapter's underlying decision. That is how a practical guide stays useful while the product improves.

Working reference

Commands and patterns

Create a no-dependency starter repository

mkdir codex-starter
cd codex-starter
git init
touch README.md
pwd
git status --short
codex

This creates and opens a tiny Git-backed workspace. At the Codex prompt, ask for a three-file static page and require instructions for opening it locally.

Open an existing repository

git clone <repository-url> codex-starter
cd codex-starter
git status --short
codex

Replace the placeholder with a repository URL you are authorized to use. Read the README and existing status before requesting edits.

Confirm local repository state

pwd
git rev-parse --show-toplevel
git branch --show-current
git status --short

These read-only commands establish the current folder, Git root, branch, and uncommitted work before a local task begins.

Inspect the installed CLI

git --version
codex --version
codex --help

Use the live help output and current official CLI page for available commands instead of copying a possibly stale flag from a tutorial.

When the happy path breaks

Failure modes

01

Symptom

Codex makes a correct edit, but the application you care about does not change.

Likely cause

The task ran against a different checkout, branch, environment, or deployment layer.

Recovery

Stop. Resolve the canonical project, Git root, branch, runtime, and public release path with read-only evidence before repeating the work.

02

Symptom

A cloud task cannot find a local file, credential, service, or uncommitted edit.

Likely cause

A hosted environment does not automatically inherit the state of the local machine.

Recovery

Move only the required source and setup into the cloud environment, or perform the task locally. Do not paste secret values into a prompt to bridge the gap.

03

Symptom

The first task touches many files and introduces unfamiliar architecture.

Likely cause

The request described an ambition but did not define a bounded first outcome or pass/fail check.

Recovery

Interrupt the run, choose one reversible vertical slice, and request a file-level plan plus a named verification step before editing.

04

Symptom

A tutorial's button or mode name is missing.

Likely cause

The interface evolved after the tutorial was written.

Recovery

Identify the durable job the control performed and locate its current equivalent in the linked first-party documentation.

05

Symptom

The terminal prints `command not found: codex` or Codex cannot sign in.

Likely cause

The CLI is not installed, its executable is not on the shell PATH, or authentication has not completed.

Recovery

Stop retrying the task. Follow the current official quickstart, reopen the terminal after installation, confirm `codex --version`, then complete sign-in before entering the project.

06

Symptom

Codex starts, but it sees an empty or unrelated folder.

Likely cause

The terminal was launched from the wrong current directory or the desktop/IDE project points elsewhere.

Recovery

Run `pwd`, `ls`, and `git rev-parse --show-toplevel`; then reopen or relaunch Codex from the intended project root.

Hands-on lab

Complete one verified Codex task

Use a real but low-risk project to practice the full loop from surface selection to evidence.

  1. 01If you have no project, run the starter commands, launch Codex in that folder, and ask it to create a static three-file personal landing page. Otherwise clone or open a low-risk repository you control.
  2. 02Run `pwd`, `git rev-parse --show-toplevel`, `git branch --show-current`, and `git status --short`; save the output as your environment header.
  3. 03Choose the app, CLI, IDE, or cloud and write one sentence explaining why that surface fits. Use CLI for this first starter unless visual preview is the lesson goal.
  4. 04Ask Codex to explain its three-file plan before editing, to avoid dependencies, and to state how the result will be opened or served.
  5. 05Let Codex implement, then inspect `git diff --stat` and `git diff`. Ask about every changed file you do not understand.
  6. 06Open the page or run the relevant check, test one interaction, and capture the exact path or URL plus the observed result.
  7. 07Intentionally mistype one harmless command, read the error, then correct it. Record the command, output, and exit status so setup recovery becomes familiar.
  8. 08Write what is proven, what is merely inferred, and what remains unverified.

Deliverable: A working starter or opened repository, surface decision, terminal environment header, narrow diff, verification output, one recovered error, and one visible receipt.

Reusable artifact

Codex task header

A compact header that prevents environment and authority confusion at the start of a consequential task.

Surface: [app / CLI / IDE / cloud]
Canonical project: [path or hosted repository]
Branch or task environment: [name]
Existing changes to preserve: [summary]
Outcome: [one observable user result]
Allowed scope: [files, directories, tools, systems]
Forbidden actions: [publish, delete, message, purchase, expose secrets, etc.]
Verification layer: [source / local runtime / preview / production]
Pass condition: [specific evidence]
Pause when: [ambiguity or authority boundary]

Before you move on

Receipt checklist

  • The chosen Codex surface is named and justified by the task's environment and review needs.
  • The canonical project, branch, and pre-existing changes are recorded.
  • The final diff is narrow, reversible, and free of unrelated edits.
  • The relevant command or user flow succeeds in the named environment.
  • The completion statement distinguishes confirmed behavior from remaining uncertainty.

Primary sources

Continue with the source

Home
Book
Blog
Calugaru Labs
GitHub
LinkedIn
Email
Theme