Codex
Install Statewright in Codex and connect your account in a browser
Codex
Statewright adds workflow tools and phase-specific tool policy to Codex. In a managed terminal or supported Desktop session, its App Server adapter can apply model and reasoning routes to subsequent turns at workflow boundaries. It does not change a model halfway through a response. The optional legacy transport uses process restarts instead.
Install
Run these commands in your terminal:
codex plugin marketplace add statewright/statewright
codex plugin add statewright@statewrightRestart Codex after installation so its hooks and managed launcher are active. The plugin is dormant until a workflow is loaded.
Connect your account
Ask Codex to call statewright_connect. The tool returns a short-lived device code and opens a Statewright page in your browser. Check that the code on the page matches, choose Google, GitHub, Microsoft, or email, then approve the connection. Leave Codex open while it waits for confirmation. Once it reports success, you can use your workflows without copying a key into the chat.
If the browser does not open, use the approval URL returned by statewright_connect. If the code expires, call the tool again for a new one. See OAuth login for the complete flow and troubleshooting.
The plugin saves the credential in your operating system's credential store. Credentials are separate for each gateway, so connecting to staging or a development gateway does not replace your production login. A Linux desktop needs an available, unlocked Secret Service; headless automation can use a process-scoped STATEWRIGHT_API_KEY instead.
Start a workflow
Ask Codex to find or list your workflows, then call statewright_load_workflow with the workflow you want. After each phase, follow the returned allowed tools and transition instructions. Read, Grep, and Glob in a workflow are capabilities: Codex may satisfy them with allowed read-only commands such as cat or rg, rather than tools with those exact names.
Where model routing works
Managed Codex CLI and supported local Desktop sessions can apply phase-specific model routes at a session boundary. An existing session started before the launcher was installed may need a restart. ChatGPT web is a different host: Statewright can guide and record its workflow, but cannot change the model selected by ChatGPT. The integration should say when the host owns model selection; do not treat a requested route as proof that it was applied.
See ChatGPT Desktop with Codex for the macOS launcher, historical conversations, approvals and recovery. A cloud conversation opened in Desktop still needs its own remote connector.
Gateway profiles
The OAuth login guide shows the non-secret gateway profile format for staging and development environments. For a new account, browser approval is the supported path; the old single-gateway key file is only a production migration fallback.