Start from the project, not the live server
Codex works best when the complete application is in a local Git repository. The repository should contain the source code, dependency lock files, build instructions and safe example environment values.
Do not begin by giving an agent unrestricted access to a production document root. A local checkout provides reviewable changes, repeatable builds and a reliable way to reverse an incorrect edit.
- Clone the project to your computer or open the existing local repository.
- Confirm the repository does not contain live passwords, private keys or customer exports.
- Run the project locally and record the commands that install, build, test and start it.
- Create a Git checkpoint before asking Codex to make changes.
Open the project in Codex
- In the ChatGPT desktop app, add or select the folder that contains the project repository. In Codex CLI, open a terminal in the project directory and run codex.
- Use the local environment when you need Codex to run the same development tools installed on your computer.
- Begin with a read-only request such as: inspect this project and explain its build, test and deployment process.
- Check the active workspace and permissions before allowing edits or network commands.
- Add project instructions describing the framework, required checks, protected files and deployment method.
Use a reviewable change workflow
- Ask for one defined change and its acceptance criteria.
- Have Codex inspect the relevant code before editing it.
- Run formatting, type checks, tests and a production build after the edit.
- Review the complete diff and check for unexpected dependency, configuration or permission changes.
- Commit the verified result on a dedicated branch or checkpoint.
Codex can run commands inside the active workspace, but network access and files outside that workspace may require explicit permission. Grant only what the current task needs.
Connect deployment separately
A deployment connection should be a controlled tool, not permanent unrestricted server access. Use a dedicated SSH key or a Git-based deployment workflow with the minimum permissions needed for one website.
- Create a restricted deployment user or website-level SSH account.
- Keep the private key outside the repository and restrict access to the key file.
- Document the server hostname, SSH user, port, release directory and health-check URL without recording the private key itself.
- Require a backup, clean production build and explicit verification before the active release changes.
- Keep the previous release available until the new site passes its health and content checks.
Official references
Platforms and tools change over time. Use these official references for the current product documentation.