# Codex sessions



Cluster Build can run an installed **Codex CLI** as a native agent, in
the terminal or on the Build daemon. With
[remote control](/docs/build/interactive#remote-control) on, your other devices
can also start Codex sessions on this machine.

Build doesn't require a specific Codex version; if the installed version isn't
compatible, the session fails with an error before it starts.

```bash
cluster --agent codex
cluster exec --agent codex "Explain this repository"
cluster exec --agent codex --model gpt-5.5 --json "Explain this repository"
cluster resume <build-session-id>
cluster exec --resume <build-session-id> "Continue"
```

To invoke an enabled Codex project skill, include `$skill-name` in your prompt.
When using `cluster exec`, quote the prompt with single quotes so your shell
doesn't expand the `$`:

```bash
cluster exec --agent codex '$review-checklist Review this change'
```

Resolve workspace trust and sign in to Cluster normally. Build's account owns the
session and its transcript; Codex separately uses its own login and
configuration, so install and authenticate Codex before launching it through
Build. The Codex process receives an allowlisted environment (including
`CODEX_HOME` and `OPENAI_API_KEY`) but no Cluster access or refresh tokens.

Codex owns its instructions, model context, tools, MCP configuration, and native
history. Build doesn't inject its model catalog, tools, skills, or memory into an
external session. The footer identifies Codex, and `/status` and the startup
banner show its execution policy.

Codex MCP tool results display their text output, or JSON when the result has
only structured content. Native tool errors retain their error message.

## Execution and consent [#execution-and-consent]

New Codex sessions default to **Ask**. Remote clients offer three permission modes:

* **Ask** uses a read-only sandbox with on-request approval reviewed by you. This
  isn't an ask-before-every-command policy.
* **Auto** uses a workspace-write sandbox with network access enabled and Codex's
  automatic approval reviewer. It isn't unrestricted access.
* **Full access** disables the sandbox and runs commands and edits without
  approval prompts.

The host confirms and saves the selected mode, restoring it after reconnect or
host restart. Changing modes interrupts active work and cancels pending approvals;
interrupted commands are never replayed. Codex's background terminals are also
stopped. If a change can't be applied or saved, the native process closes;
reconnect to restore the saved policy. Build never silently escalates access to
make a tool work.

* Command approval shows the native command and working directory. **Run once**
  allows that request only; **Cancel turn** cancels through Codex.
* Multiple-choice questions use Build's question UI. Secret-input and unsupported
  question shapes are refused.
* Only the session's active viewer can answer.

Headless runs refuse interactions immediately. Exit codes are `0` for success,
`1` for failure or a required headless interaction, and `130` for a cancelled
turn. With `--json`, the result includes the Build session ID, native model,
observed text, `stopped_early`, and `backend: "codex"`.

`Esc` interrupts a turn without shutting down the Codex process, and the next
turn continues the same native thread. Quitting the session closes the Codex
process. A daemon keeps an actively working session after its viewer leaves, as
it does for Cluster sessions.

## History and resume [#history-and-resume]

Build keeps its own display transcript under `~/.cluster/sessions`; Codex keeps
its native session in `CODEX_HOME` (normally `~/.codex`). Deleting a session in
Build doesn't delete Codex's native history.

Resume automatically selects the saved backend, and an explicit conflicting
`--agent` is refused. The native thread reference stays on the host, so moving
only Build's transcript to another machine doesn't move Codex history. If native
history is missing, resume fails rather than starting a replacement thread.

## Edit an earlier message [#edit-an-earlier-message]

In a remote Codex session in the Cluster mobile app, editing an earlier message
loads its text and attachments into the composer. You can change both before
sending. Canceling leaves the conversation unchanged.

Sending the edit removes the original turn and all later turns from both the
Build transcript and Codex's conversation history. The edited message starts a
replacement turn on the same thread, with the earlier conversation still in
context. Rewinding doesn't undo changes to workspace files or change the
session's current permission mode.

Editing requires a connected session that supports rewind. Wait for Codex to
finish its turn and any running tools before sending the edit. If Build can't
identify the original turn in an older session, it leaves the conversation
unchanged.

## Limitations [#limitations]

Codex sessions support text, [attachments](/docs/build/interactive#native-agent-attachments),
tool display, command approval, questions, interruption, clear, history, and
resume. They don't support steering, plan mode, compaction, changing the model within a session,
forking, goals/automations, or `exec --ephemeral`. Pick a model when
starting headless execution, or in Codex's own configuration.
