> For the complete documentation index, see [llms.txt](https://pharaoh.so/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pharaoh.so/docs/connect/codex.md).

# Codex

Install Pharaoh for Codex CLI or desktop with the managed npx installer, preserve custom settings, and check local setup without uploading files.

Run the installer in the environment where you use Codex CLI or the Codex desktop app:

```sh
npx @pharaoh-so/mcp@latest install
```

Complete GitHub sign-in and follow the result printed for Codex. The installer checks each supported client independently; the Codex CLI is optional for desktop setup. It configures a local stdio MCP connection using an exact-version managed runtime and an absolute Node executable. Codex configuration honors `CODEX_HOME`, or uses `~/.codex/` by default.

Choose **Global (recommended)** for automatic setup across projects, or **Local** for the current Git checkout. Local requires a supported Codex CLI and writes project MCP configuration, hooks and skills. Credentials and runtime binaries remain shared under `~/.pharaoh`; memory and runtime analytics retain their defaults and saved choices. Project and hook trust remain Codex's own approval steps.

Use `npx @pharaoh-so/mcp@latest install --scope local --path /path/to/repo` for an explicit Local target. If Global is already active, follow the printed scoped cleanup command before switching. Local changes where the client activates Pharaoh, not the GitHub App's repository permissions.

Existing custom or disabled Pharaoh registrations are preserved. A malformed or ambiguous configuration needs the recovery action in the report. An enabled legacy version-pinned npx entry requires migration confirmation; the report gives `npx @pharaoh-so/mcp@latest install --migrate-legacy` for noninteractive migration. Successful setup for another client is retained if Codex setup fails.

Enabled coding clients receive the shipped workflow skills. An interactive instruction choice can add the Pharaoh-first line to Codex's global instructions, honoring a nonempty `AGENTS.override.md` before `AGENTS.md`. Edited files and custom skills are preserved. Eligible accounts get project-memory reminders by default. Setup remembers `--disable-memory-hooks` across reinstalls.

Follow the installer's restart and trust instructions. In your repository, ask Codex:

```
Run the Pharaoh setup tool.
```

## Check local setup

`npx @pharaoh-so/mcp --doctor` provides an offline, read-only check of bounded local Claude plugin and instruction markers. It does not upload observations, inspect Codex's loaded context or infer which agent is running. Codex project instruction markers remain unknown. Its version belongs to the command you ran; it does not establish the runtime registered in Codex.

The npx launcher may need to download the package first. Once cached, `npx --offline @pharaoh-so/mcp --doctor` avoids a registry request too. See [Headless and SSH](https://pharaoh.so/docs/connect/headless.md) for remote environments.

## HTTPS fallback

A client that cannot launch a local MCP process can connect to `https://mcp.pharaoh.so/mcp` over HTTPS. An existing direct Codex HTTP registration stays available; it does not report the local proxy's setup observations. Keep one working Pharaoh registration and follow the installer's recovery instructions before replacing it.

## Upgrade or change accounts

Ask the connected agent to run `pharaoh_update`, then start a new session to use the verified update. This keeps the existing registration and scope. To adopt or repair a Local installation, run the installer with `--scope local` from its checkout. To change the GitHub account used by the local proxy, run `npx @pharaoh-so/mcp@latest --logout`, then install again and sign in with the intended account.

A direct Codex HTTP connection uses `codex mcp logout pharaoh`, then `codex mcp login pharaoh` instead.
