cli/reference.md +199 −12
280| [`codex app`](https://developers.openai.com/codex/cli/reference#codex-app) | Stable | Launch the Codex desktop app on macOS or Windows. On macOS, Codex can open a workspace path; on Windows, Codex prints the path to open. |280| [`codex app`](https://developers.openai.com/codex/cli/reference#codex-app) | Stable | Launch the Codex desktop app on macOS or Windows. On macOS, Codex can open a workspace path; on Windows, Codex prints the path to open. |
281| [`codex app-server`](https://developers.openai.com/codex/cli/reference#codex-app-server) | Experimental | Launch the Codex app server for local development or debugging over stdio, WebSocket, or a Unix socket. |281| [`codex app-server`](https://developers.openai.com/codex/cli/reference#codex-app-server) | Experimental | Launch the Codex app server for local development or debugging over stdio, WebSocket, or a Unix socket. |
282| [`codex apply`](https://developers.openai.com/codex/cli/reference#codex-apply) | Stable | Apply the latest diff generated by a Codex Cloud task to your local working tree. Alias: `codex a`. |282| [`codex apply`](https://developers.openai.com/codex/cli/reference#codex-apply) | Stable | Apply the latest diff generated by a Codex Cloud task to your local working tree. Alias: `codex a`. |
283| [`codex archive`](https://developers.openai.com/codex/cli/reference#codex-archive-and-codex-unarchive) | Stable | Archive a saved interactive session by session ID or session name. |
283| [`codex cloud`](https://developers.openai.com/codex/cli/reference#codex-cloud) | Experimental | Browse or execute Codex Cloud tasks from the terminal without opening the TUI. Alias: `codex cloud-tasks`. |284| [`codex cloud`](https://developers.openai.com/codex/cli/reference#codex-cloud) | Experimental | Browse or execute Codex Cloud tasks from the terminal without opening the TUI. Alias: `codex cloud-tasks`. |
284| [`codex completion`](https://developers.openai.com/codex/cli/reference#codex-completion) | Stable | Generate shell completion scripts for Bash, Zsh, Fish, or PowerShell. |285| [`codex completion`](https://developers.openai.com/codex/cli/reference#codex-completion) | Stable | Generate shell completion scripts for Bash, Zsh, Fish, or PowerShell. |
285| [`codex debug app-server send-message-v2`](https://developers.openai.com/codex/cli/reference#codex-debug-app-server-send-message-v2) | Experimental | Debug app-server by sending a single V2 message through the built-in test client. |286| [`codex debug app-server send-message-v2`](https://developers.openai.com/codex/cli/reference#codex-debug-app-server-send-message-v2) | Experimental | Debug app-server by sending a single V2 message through the built-in test client. |
293| [`codex logout`](https://developers.openai.com/codex/cli/reference#codex-logout) | Stable | Remove stored authentication credentials. |294| [`codex logout`](https://developers.openai.com/codex/cli/reference#codex-logout) | Stable | Remove stored authentication credentials. |
294| [`codex mcp`](https://developers.openai.com/codex/cli/reference#codex-mcp) | Experimental | Manage Model Context Protocol servers (list, add, remove, authenticate). |295| [`codex mcp`](https://developers.openai.com/codex/cli/reference#codex-mcp) | Experimental | Manage Model Context Protocol servers (list, add, remove, authenticate). |
295| [`codex mcp-server`](https://developers.openai.com/codex/cli/reference#codex-mcp-server) | Experimental | Run Codex itself as an MCP server over stdio. Useful when another agent consumes Codex. |296| [`codex mcp-server`](https://developers.openai.com/codex/cli/reference#codex-mcp-server) | Experimental | Run Codex itself as an MCP server over stdio. Useful when another agent consumes Codex. |
297| [`codex plugin`](https://developers.openai.com/codex/cli/reference#codex-plugin) | Experimental | Install, list, and remove plugins from configured marketplace sources. |
296| [`codex plugin marketplace`](https://developers.openai.com/codex/cli/reference#codex-plugin-marketplace) | Experimental | Add, list, upgrade, or remove plugin marketplaces from Git or local sources. |298| [`codex plugin marketplace`](https://developers.openai.com/codex/cli/reference#codex-plugin-marketplace) | Experimental | Add, list, upgrade, or remove plugin marketplaces from Git or local sources. |
297| [`codex remote-control`](https://developers.openai.com/codex/cli/reference#codex-remote-control) | Experimental | Ensure the local app-server daemon is running with remote-control support enabled. |299| [`codex remote-control`](https://developers.openai.com/codex/cli/reference#codex-remote-control) | Experimental | Ensure the local app-server daemon is running with remote-control support enabled. |
298| [`codex resume`](https://developers.openai.com/codex/cli/reference#codex-resume) | Stable | Continue a previous interactive session by ID or resume the most recent conversation. |300| [`codex resume`](https://developers.openai.com/codex/cli/reference#codex-resume) | Stable | Continue a previous interactive session by ID or resume the most recent conversation. |
299| [`codex sandbox`](https://developers.openai.com/codex/cli/reference#codex-sandbox) | Experimental | Run arbitrary commands inside Codex-provided macOS, Linux, or Windows sandboxes. |301| [`codex sandbox`](https://developers.openai.com/codex/cli/reference#codex-sandbox) | Experimental | Run arbitrary commands inside Codex-provided macOS, Linux, or Windows sandboxes. |
302| [`codex unarchive`](https://developers.openai.com/codex/cli/reference#codex-archive-and-codex-unarchive) | Stable | Restore an archived interactive session by session ID or session name. |
300| [`codex update`](https://developers.openai.com/codex/cli/reference#codex-update) | Stable | Check for and apply a Codex CLI update when the installed release supports self-update. |303| [`codex update`](https://developers.openai.com/codex/cli/reference#codex-update) | Stable | Check for and apply a Codex CLI update when the installed release supports self-update. |
301 304
302Key305Key
349 352
350Key353Key
351 354
355[`codex archive`](https://developers.openai.com/codex/cli/reference#codex-archive-and-codex-unarchive)
356
357Maturity
358
359Stable
360
361Details
362
363Archive a saved interactive session by session ID or session name.
364
365Key
366
352[`codex cloud`](https://developers.openai.com/codex/cli/reference#codex-cloud)367[`codex cloud`](https://developers.openai.com/codex/cli/reference#codex-cloud)
353 368
354Maturity369Maturity
505 520
506Key521Key
507 522
523[`codex plugin`](https://developers.openai.com/codex/cli/reference#codex-plugin)
524
525Maturity
526
527Experimental
528
529Details
530
531Install, list, and remove plugins from configured marketplace sources.
532
533Key
534
508[`codex plugin marketplace`](https://developers.openai.com/codex/cli/reference#codex-plugin-marketplace)535[`codex plugin marketplace`](https://developers.openai.com/codex/cli/reference#codex-plugin-marketplace)
509 536
510Maturity537Maturity
553 580
554Key581Key
555 582
583[`codex unarchive`](https://developers.openai.com/codex/cli/reference#codex-archive-and-codex-unarchive)
584
585Maturity
586
587Stable
588
589Details
590
591Restore an archived interactive session by session ID or session name.
592
593Key
594
556[`codex update`](https://developers.openai.com/codex/cli/reference#codex-update)595[`codex update`](https://developers.openai.com/codex/cli/reference#codex-update)
557 596
558Maturity597Maturity
581| --- | --- | --- |620| --- | --- | --- |
582| `--analytics-default-enabled` | `boolean` | Defaults analytics to enabled for first-party app-server clients unless the user opts out in config. |621| `--analytics-default-enabled` | `boolean` | Defaults analytics to enabled for first-party app-server clients unless the user opts out in config. |
583| `--listen` | `stdio:// | ws://IP:PORT | unix:// | unix://PATH | off` | Transport listener URL. Use `stdio://` for JSONL, `ws://IP:PORT` for a TCP WebSocket endpoint, `unix://` for the default Unix socket, `unix://PATH` for a custom Unix socket, or `off` to disable the local transport. |622| `--listen` | `stdio:// | ws://IP:PORT | unix:// | unix://PATH | off` | Transport listener URL. Use `stdio://` for JSONL, `ws://IP:PORT` for a TCP WebSocket endpoint, `unix://` for the default Unix socket, `unix://PATH` for a custom Unix socket, or `off` to disable the local transport. |
623| `--stdio` | `boolean` | Use stdio transport. Equivalent to `--listen stdio://` and mutually exclusive with `--listen`. |
584| `--ws-audience` | `string` | Expected `aud` claim for signed bearer tokens. Requires `--ws-auth signed-bearer-token`. |624| `--ws-audience` | `string` | Expected `aud` claim for signed bearer tokens. Requires `--ws-auth signed-bearer-token`. |
585| `--ws-auth` | `capability-token | signed-bearer-token` | Authentication mode for app-server WebSocket clients. If omitted, WebSocket auth is disabled; non-local listeners warn during startup. |625| `--ws-auth` | `capability-token | signed-bearer-token` | Authentication mode for app-server WebSocket clients. If omitted, WebSocket auth is disabled; non-local listeners warn during startup. |
586| `--ws-issuer` | `string` | Expected `iss` claim for signed bearer tokens. Requires `--ws-auth signed-bearer-token`. |626| `--ws-issuer` | `string` | Expected `iss` claim for signed bearer tokens. Requires `--ws-auth signed-bearer-token`. |
615 655
616Key656Key
617 657
658`--stdio`
659
660Type / Values
661
662`boolean`
663
664Details
665
666Use stdio transport. Equivalent to `--listen stdio://` and mutually exclusive with `--listen`.
667
668Key
669
618`--ws-audience`670`--ws-audience`
619 671
620Type / Values672Type / Values
697 749
698Expected SHA-256 digest for capability-token authentication. Use instead of `--ws-token-file` when the client token comes from another source.750Expected SHA-256 digest for capability-token authentication. Use instead of `--ws-token-file` when the client token comes from another source.
699 751
700752`codex app-server --listen stdio://` keeps the default JSONL-over-stdio behavior. `--listen ws://IP:PORT` enables WebSocket transport for app-server clients. The server accepts `ws://` listen URLs; use TLS termination or a secure proxy when clients connect with `wss://`. Use `--listen unix://` to accept WebSocket handshakes on Codex’s default Unix socket, or `--listen unix:///absolute/path.sock` to choose a socket path. If you generate schemas for client bindings, add `--experimental` to include gated fields and methods.`codex app-server --listen stdio://` keeps the default JSONL-over-stdio behavior, and `codex app-server --stdio` is an alias for that transport. `--listen ws://IP:PORT` enables WebSocket transport for app-server clients. The server accepts `ws://` listen URLs; use TLS termination or a secure proxy when clients connect with `wss://`. Use `--listen unix://` to accept WebSocket handshakes on Codex’s default Unix socket, or `--listen unix:///absolute/path.sock` to choose a socket path. If you generate schemas for client bindings, add `--experimental` to include gated fields and methods.
701 753
702### `codex remote-control`754### `codex remote-control`
703 755
809 861
810Codex prints the patched files and exits non-zero if `git apply` fails (for example, due to conflicts).862Codex prints the patched files and exits non-zero if `git apply` fails (for example, due to conflicts).
811 863
864### `codex archive` and `codex unarchive`
865
866Archive or restore a saved interactive session by session ID or session name.
867Use these commands when you want to clean up the session picker without deleting
868the transcript. Session IDs take precedence over session names.
869
870```
871codex archive <SESSION>
872codex unarchive <SESSION>
873```
874
875| Key | Type / Values | Details |
876| --- | --- | --- |
877| `--remote` | `ws://host:port | wss://host:port | unix:// | unix://PATH` | Connect to a remote app-server endpoint before changing archive state. |
878| `--remote-auth-token-env` | `ENV_VAR` | Read a bearer token from this environment variable when `--remote` requires authentication. |
879| `SESSION` | `session ID | session name` | Saved session to archive or restore. Session IDs take precedence over session names. |
880
881Key
882
883`--remote`
884
885Type / Values
886
887`ws://host:port | wss://host:port | unix:// | unix://PATH`
888
889Details
890
891Connect to a remote app-server endpoint before changing archive state.
892
893Key
894
895`--remote-auth-token-env`
896
897Type / Values
898
899`ENV_VAR`
900
901Details
902
903Read a bearer token from this environment variable when `--remote` requires authentication.
904
905Key
906
907`SESSION`
908
909Type / Values
910
911`session ID | session name`
912
913Details
914
915Saved session to archive or restore. Session IDs take precedence over session names.
916
812### `codex cloud`917### `codex cloud`
813 918
814Interact with Codex cloud tasks from the terminal. The default command opens an interactive picker; `codex cloud exec` submits a task directly, and `codex cloud list` returns recent tasks for scripting or quick inspection.919Interact with Codex cloud tasks from the terminal. The default command opens an interactive picker; `codex cloud exec` submits a task directly, and `codex cloud list` returns recent tasks for scripting or quick inspection.
1673 1778
1674OAuth actions (`login`, `logout`) only work with streamable HTTP servers (and only when the server supports OAuth).1779OAuth actions (`login`, `logout`) only work with streamable HTTP servers (and only when the server supports OAuth).
1675 1780
1781### `codex plugin`
1782
1783Install, list, and remove plugins from configured marketplaces.
1784
1785| Key | Type / Values | Details |
1786| --- | --- | --- |
1787| `add <plugin[@marketplace]>` | `[--marketplace, -m NAME] [--json]` | Install a plugin from a configured marketplace. Use `--marketplace` or `-m` when the plugin argument omits `@marketplace`. |
1788| `list` | `[--marketplace, -m NAME] [--available --json] [--json]` | List installed plugins. With `--json`, output has `installed` and `available` arrays; `--available` includes uninstalled marketplace plugins and requires `--json`. |
1789| `marketplace` | | Manage configured marketplace sources. See `codex plugin marketplace` below. |
1790| `remove <plugin[@marketplace]>` | `[--marketplace, -m NAME] [--json]` | Remove an installed plugin from local config and cache. Use `--json` for automation-friendly output. |
1791
1792Key
1793
1794`add <plugin[@marketplace]>`
1795
1796Type / Values
1797
1798`[--marketplace, -m NAME] [--json]`
1799
1800Details
1801
1802Install a plugin from a configured marketplace. Use `--marketplace` or `-m` when the plugin argument omits `@marketplace`.
1803
1804Key
1805
1806`list`
1807
1808Type / Values
1809
1810`[--marketplace, -m NAME] [--available --json] [--json]`
1811
1812Details
1813
1814List installed plugins. With `--json`, output has `installed` and `available` arrays; `--available` includes uninstalled marketplace plugins and requires `--json`.
1815
1816Key
1817
1818`marketplace`
1819
1820Details
1821
1822Manage configured marketplace sources. See `codex plugin marketplace` below.
1823
1824Key
1825
1826`remove <plugin[@marketplace]>`
1827
1828Type / Values
1829
1830`[--marketplace, -m NAME] [--json]`
1831
1832Details
1833
1834Remove an installed plugin from local config and cache. Use `--json` for automation-friendly output.
1835
1836`codex plugin add --json` prints `pluginId`, `name`, `marketplaceName`,
1837`version`, `installedPath`, and `authPolicy`. `codex plugin list --json` prints
1838`installed` and `available` arrays. Entries include `pluginId`, `name`,
1839`marketplaceName`, `version`, `installed`, `enabled`, `source`, `installPolicy`,
1840`authPolicy`, and, when available, `marketplaceSource` with the configured
1841marketplace source type and value. `codex plugin remove --json` prints
1842`pluginId`, `name`, and `marketplaceName`.
1843
1676### `codex plugin marketplace`1844### `codex plugin marketplace`
1677 1845
1678Manage plugin marketplace sources that Codex can browse and install from.1846Manage plugin marketplace sources that Codex can browse and install from.
1679 1847
1680| Key | Type / Values | Details |1848| Key | Type / Values | Details |
1681| --- | --- | --- |1849| --- | --- | --- |
16821850| `add <source>` | `[--ref REF] [--sparse PATH]` | Install a plugin marketplace from GitHub shorthand, a Git URL, an SSH URL, or a local marketplace root directory. `--sparse` is supported only for Git sources and can be repeated. || `add <source>` | `[--ref REF] [--sparse PATH] [--json]` | Install a plugin marketplace from GitHub shorthand, a Git URL, an SSH URL, or a local marketplace root directory. `--sparse` is supported only for Git sources and can be repeated. |
16831851| `list` | | Show plugin marketplaces Codex is currently considering and the root path for each marketplace. || `list` | `[--json]` | Show plugin marketplaces Codex is currently considering and the root path for each marketplace. |
16841852| `remove <marketplace-name>` | | Remove a configured plugin marketplace. || `remove <marketplace-name>` | `[--json]` | Remove a configured plugin marketplace. |
16851853| `upgrade [marketplace-name]` | | Refresh one configured Git marketplace, or all configured Git marketplaces when no name is provided. || `upgrade [marketplace-name]` | `[--json]` | Refresh one configured Git marketplace, or all configured Git marketplaces when no name is provided. |
1686 1854
1687Key1855Key
1688 1856
1690 1858
1691Type / Values1859Type / Values
1692 1860
16931861`[--ref REF] [--sparse PATH]``[--ref REF] [--sparse PATH] [--json]`
1694 1862
1695Details1863Details
1696 1864
1700 1868
1701`list`1869`list`
1702 1870
1871Type / Values
1872
1873`[--json]`
1874
1703Details1875Details
1704 1876
1705Show plugin marketplaces Codex is currently considering and the root path for each marketplace.1877Show plugin marketplaces Codex is currently considering and the root path for each marketplace.
1708 1880
1709`remove <marketplace-name>`1881`remove <marketplace-name>`
1710 1882
1883Type / Values
1884
1885`[--json]`
1886
1711Details1887Details
1712 1888
1713Remove a configured plugin marketplace.1889Remove a configured plugin marketplace.
1716 1892
1717`upgrade [marketplace-name]`1893`upgrade [marketplace-name]`
1718 1894
1895Type / Values
1896
1897`[--json]`
1898
1719Details1899Details
1720 1900
1721Refresh one configured Git marketplace, or all configured Git marketplaces when no name is provided.1901Refresh one configured Git marketplace, or all configured Git marketplaces when no name is provided.
1729including implicitly discovered default marketplaces and configured marketplace1909including implicitly discovered default marketplaces and configured marketplace
1730snapshots.1910snapshots.
1731 1911
1912Add `--json` to marketplace add, list, upgrade, or remove commands for
1913automation-friendly output. Marketplace add JSON includes `marketplaceName`,
1914`installedRoot`, and `alreadyAdded`; list JSON includes a `marketplaces` array
1915with `name`, `root`, and optional `marketplaceSource`; upgrade JSON includes
1916`selectedMarketplaces`, `upgradedRoots`, and `errors`; remove JSON includes
1917`marketplaceName` and `installedRoot`.
1918
1732### `codex mcp-server`1919### `codex mcp-server`
1733 1920
1734Run Codex as an MCP server over stdio so that other tools can connect. This command inherits global configuration overrides and exits when the downstream client closes the connection.1921Run Codex as an MCP server over stdio so that other tools can connect. This command inherits global configuration overrides and exits when the downstream client closes the connection.
1838| `--config, -c` | `key=value` | Pass configuration overrides into the sandboxed run (repeatable). |2025| `--config, -c` | `key=value` | Pass configuration overrides into the sandboxed run (repeatable). |
1839| `--include-managed-config` | `boolean` | Include managed requirements while resolving an explicit permissions profile. Requires `--permissions-profile`. |2026| `--include-managed-config` | `boolean` | Include managed requirements while resolving an explicit permissions profile. Requires `--permissions-profile`. |
1840| `--log-denials` | `boolean` | Capture macOS sandbox denials with `log stream` while the command runs and print them after exit. |2027| `--log-denials` | `boolean` | Capture macOS sandbox denials with `log stream` while the command runs and print them after exit. |
18412028| `--permissions-profile` | `NAME` | Apply a named permissions profile from the active configuration stack. || `--permissions-profile, -P` | `NAME` | Apply a named permissions profile from the active configuration stack. |
1842| `--profile, -p` | `NAME` | Layer `$CODEX_HOME/NAME.config.toml` on top of the base user config. |2029| `--profile, -p` | `NAME` | Layer `$CODEX_HOME/NAME.config.toml` on top of the base user config. |
1843| `COMMAND...` | `var-args` | Shell command to execute under macOS Seatbelt. Everything after `--` is forwarded. |2030| `COMMAND...` | `var-args` | Shell command to execute under macOS Seatbelt. Everything after `--` is forwarded. |
1844 2031
1904 2091
1905Key2092Key
1906 2093
19072094`--permissions-profile``--permissions-profile, -P`
1908 2095
1909Type / Values2096Type / Values
1910 2097
1945| `--cd, -C` | `DIR` | Working directory used for profile resolution and command execution. Requires `--permissions-profile`. |2132| `--cd, -C` | `DIR` | Working directory used for profile resolution and command execution. Requires `--permissions-profile`. |
1946| `--config, -c` | `key=value` | Configuration overrides applied before launching the sandbox (repeatable). |2133| `--config, -c` | `key=value` | Configuration overrides applied before launching the sandbox (repeatable). |
1947| `--include-managed-config` | `boolean` | Include managed requirements while resolving an explicit permissions profile. Requires `--permissions-profile`. |2134| `--include-managed-config` | `boolean` | Include managed requirements while resolving an explicit permissions profile. Requires `--permissions-profile`. |
19482135| `--permissions-profile` | `NAME` | Apply a named permissions profile from the active configuration stack. || `--permissions-profile, -P` | `NAME` | Apply a named permissions profile from the active configuration stack. |
1949| `--profile, -p` | `NAME` | Layer `$CODEX_HOME/NAME.config.toml` on top of the base user config. |2136| `--profile, -p` | `NAME` | Layer `$CODEX_HOME/NAME.config.toml` on top of the base user config. |
1950| `COMMAND...` | `var-args` | Command to execute under Landlock + seccomp. Provide the executable after `--`. |2137| `COMMAND...` | `var-args` | Command to execute under Landlock + seccomp. Provide the executable after `--`. |
1951 2138
1987 2174
1988Key2175Key
1989 2176
19902177`--permissions-profile``--permissions-profile, -P`
1991 2178
1992Type / Values2179Type / Values
1993 2180
2028| `--cd, -C` | `DIR` | Working directory used for profile resolution and command execution. Requires `--permissions-profile`. |2215| `--cd, -C` | `DIR` | Working directory used for profile resolution and command execution. Requires `--permissions-profile`. |
2029| `--config, -c` | `key=value` | Configuration overrides applied before launching the sandbox (repeatable). |2216| `--config, -c` | `key=value` | Configuration overrides applied before launching the sandbox (repeatable). |
2030| `--include-managed-config` | `boolean` | Include managed requirements while resolving an explicit permissions profile. Requires `--permissions-profile`. |2217| `--include-managed-config` | `boolean` | Include managed requirements while resolving an explicit permissions profile. Requires `--permissions-profile`. |
20312218| `--permissions-profile` | `NAME` | Apply a named permissions profile from the active configuration stack. || `--permissions-profile, -P` | `NAME` | Apply a named permissions profile from the active configuration stack. |
2032| `--profile, -p` | `NAME` | Layer `$CODEX_HOME/NAME.config.toml` on top of the base user config. |2219| `--profile, -p` | `NAME` | Layer `$CODEX_HOME/NAME.config.toml` on top of the base user config. |
2033| `COMMAND...` | `var-args` | Command to execute under the native Windows sandbox. Provide the executable after `--`. |2220| `COMMAND...` | `var-args` | Command to execute under the native Windows sandbox. Provide the executable after `--`. |
2034 2221
2070 2257
2071Key2258Key
2072 2259
20732260`--permissions-profile``--permissions-profile, -P`
2074 2261
2075Type / Values2262Type / Values
2076 2263