Add a project Codex guide: choose the right workspace

Learn how to add a project Codex can use, attach folders, choose a primary folder, set project guidance, and verify the workspace before…

Scribble workflow for adding a Codex project: goal, project, folders, primary folder, chat, and verification.

Visual summary

Scribble workflow for adding a Codex project: goal, project, folders, primary folder, chat, and verification.

  1. GOAL
  2. PROJECT
  3. FOLDERS
  4. PRIMARY
  5. CHAT
  6. VERIFY

Better Design

On this page

Direct answer

The phrase add a project Codex refers to giving Codex a defined place to work and the context for that work. In the ChatGPT desktop app, a local project can connect to folders on your computer. This guide helps you choose the right project type, set its primary folder, and verify access before asking for changes.

Summary: add a project Codex can use

Create a local project when Codex needs direct access to a codebase or files on your computer. Attach the required folders, make the main repository primary, then start one focused chat for each outcome. A ChatGPT project is different because it carries uploaded files, instructions, and connected sources instead of direct folder access.

For the CLI, the directory where you start Codex becomes the project for that chat. The IDE extension uses the open folder or workspace as its local project. Match the surface to where the work and source files live.

Use a six-stage setup loop. Define the goal, create the project, attach folders, choose the primary folder, start a focused chat, and verify the workspace.

Choose the correct project type first

Project can describe several related setups. They share organization, but they do not provide the same context or file access.

ChatGPT project
keeps related chats, uploaded files, instructions, and connected sources together. It does not directly expose a local computer folder.
Local project in the desktop app
connects chats to one or more folders on your computer. Use it for a codebase or local file collection.
Codex CLI project
uses the directory where you start `codex`, or the directory supplied with `--cd` or `-C`.
IDE workspace
uses the folder or workspace open in the editor. Select the intended root when the editor has several workspace roots.
Chat without a project
fits a self-contained question that does not need shared files, instructions, sources, or folder access.

OpenAI's Projects and chats documentation explains the current differences between ChatGPT projects, local projects, CLI directories, and IDE workspaces.

Add a local project in the desktop app

Use a local project when Codex must read or change files on your computer. Start from the desktop Projects view and keep the first setup narrow.

  1. Open the ChatGPT desktop app and sign in with the account that should own the work.
  2. From the Projects view, create a local project or open the folder that should become the project context.
  3. Open the project menu and select Edit project when you need to add or change folder access.
  4. Select Add folder, then attach only the repositories or file collections required for the related work.
  5. Point to the main repository and select Make primary. New chats will start from this folder.
  6. Start a new chat inside the project, choose Codex, and describe one concrete outcome with its acceptance criteria.
  7. Ask Codex to identify the working directory and relevant project rules before it edits files. Compare the answer with your setup.

OpenAI's desktop app quickstart shows how to install the app, choose a chat, project, or folder, and send the first Codex message.

Make the main repository the primary folder

The primary folder is more than a visual preference. Each new chat begins there, and Codex uses it as the default for Git operations. It is also the starting point for automatic discovery of `AGENTS.md`, skills, and `config.toml`.

  • Select the repository that owns the task, branch, tests, and delivery workflow.
  • Keep documentation or a related service as a secondary folder when the task needs both.
  • Switch the primary folder when a different repository becomes the true owner of the work.
  • Split work into separate projects when folders are unrelated or should not share chat access.
  • Check the primary repository before using pull request or worktree actions. Those actions target that repository.

Use multiple folders only for one connected outcome

Related folders can share a project. Examples include an application with its documentation or a website with its backend. Secondary folders remain available for search, reading, and editing. Their own project files are not discovered automatically in the same way as primary-folder files.

Use one practical test: would the same reviewer expect these folders in one change or delivery? If not, separate projects usually produce clearer permissions, prompts, diffs, and ownership.

Set the project in Codex CLI or the IDE

The CLI and IDE do not expose the desktop ChatGPT Projects view. They derive project context from the active directory or workspace instead.

CLI
change into the intended repository, then run `codex`.
CLI
run `codex --cd <directory>` or `codex -C <directory>` when the shell is elsewhere.
CLI
use `/new` for a distinct outcome and `/resume` or `codex resume` to continue a saved chat.
IDE
open the intended folder or workspace before starting a Codex chat.
IDE
select the correct root in a multi-root workspace, then confirm which files are in the current turn's context.

Put durable rules in project files

A chat transcript stores the conversation, but repository guidance should live with the project. Use `AGENTS.md` or checked-in documentation for commands, conventions, boundaries, and review requirements that future chats must find.

  • Name the approved package manager and the commands for tests, linting, type checks, and builds.
  • State which directories a task may change and which generated or vendor files it should leave alone.
  • Explain branch, ticket, commit, review, and deployment requirements in direct language.
  • Record product rules, security boundaries, content standards, and source-of-truth locations.
  • Keep task-specific acceptance criteria in the chat so durable guidance stays reusable.

OpenAI's AGENTS.md guide explains how Codex discovers global and project-scoped instructions and how deeper files can override broader guidance.

Folder access and sandbox permissions are separate

Folder access and command permission are different. Attaching a folder makes it available to the project. The sandbox still controls what local commands can read, change, or reach over the network. Treat project structure and runtime permission as two separate checks.

  • Confirm that the intended folder appears in the project before asking Codex to inspect it.
  • Check the active sandbox and approval policy before commands need broader file or network access.
  • Do not attach sensitive or unrelated folders merely to avoid a later permission request.
  • Ask for a read-only orientation first when the repository or task boundary is unfamiliar.
  • Review proposed commands and exact targets before approving material external or destructive actions.

OpenAI's sandbox documentation describes the boundary between project access, filesystem policy, network policy, and approvals.

Use focused chats and worktrees for parallel changes

A project groups related work, while each chat should own one distinct outcome. When two code changes must proceed in parallel, separate worktrees can isolate branches and files without creating unrelated projects.

  • Use another chat for a separate feature, investigation, review, or release task.
  • Use a worktree when parallel chats would otherwise edit the same working tree on different branches.
  • Keep the project attached to the supporting folders that both worktrees still need.
  • Before a worktree action, confirm the primary repository for branch and pull request targeting.
  • Archive finished chats and rename active chats by outcome so project history stays searchable.

OpenAI's worktree guide explains isolated checkouts, branch targeting, and how worktrees behave inside Codex projects.

Verify the project before requesting changes

A short orientation prompt catches most setup mistakes before they become edits in the wrong repository. Ask Codex to report evidence instead of assuming the project is configured correctly.

  1. State the current working directory and identify the primary repository.
  2. List the attached folders that are relevant to the requested outcome.
  3. Find the applicable `AGENTS.md` files and summarize the instructions that control the task.
  4. Identify the package manager, project structure, test commands, and current Git branch from repository evidence.
  5. Explain which files are likely to change and which files remain outside the task scope.
  6. Report any missing access, conflicting guidance, dirty changes, or unclear ownership before editing.
  7. Wait for confirmation when the evidence points to the wrong project, branch, or folder boundary.

Troubleshoot common project setup problems

Codex cannot see files
edit the local project and attach the missing folder, then check sandbox access.
Git commands target the wrong repository
make the intended repository primary before starting the next chat.
Project rules seem missing
place `AGENTS.md` under the primary project path and ask Codex to report its discovery chain.
A secondary repository has its own rules
open it as primary or state the rules explicitly for the bounded task.
Chats feel confused
split outcomes into separate chats and move unrelated repositories into separate projects.
CLI starts in the wrong location
launch it from the repository or pass the directory with `--cd` or `-C`.

Read the Better Design Codex apps guide for a broader view of Codex surfaces and app-based workflows.

Frequently asked questions