SpyBara
Go Premium

Documentation 2026-08-18 13:01 UTC to 2026-08-19 22:57 UTC

7 files changed +162 −30. View all changes and history on the product overview
2026
Mon 31 19:59 Sat 29 07:02 Fri 28 23:02 Thu 27 21:01 Wed 26 23:58 Tue 25 19:59 Mon 24 22:00 Fri 21 19:59 Thu 20 23:59 Wed 19 22:57 Tue 18 13:01 Mon 17 23:58 Sat 15 01:01 Fri 14 22:00 Thu 13 22:59 Wed 12 19:59 Tue 11 22:59 Mon 10 22:00 Sat 8 03:02 Fri 7 18:59 Thu 6 23:58 Wed 5 19:00 Tue 4 22:00 Mon 3 23:00 Sun 2 21:00
Details

2 2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 4 

5In the ChatGPT desktop app, worktrees let Codex run multiple independent chats in the same project without interfering with each other. For Git repositories, [scheduled tasks](https://learn.chatgpt.com/docs/automations) can run on dedicated background worktrees so they don't conflict with your ongoing work. In non-version-controlled projects, scheduled tasks run directly in the project directory. You can also start chats in a worktree manually and use Handoff to move a chat between Local and Worktree.5Worktrees let Codex run multiple independent chats in the same project without interfering with each other. The repository, worktree, and commands remain on the computer or remote development environment that contains the project. You can work directly in the ChatGPT desktop app, or use [Remote](https://learn.chatgpt.com/docs/remote) in the ChatGPT mobile app to start, guide, approve, and review worktree chats on a connected computer.

6 6 

7Worktrees are available only in Codex in the ChatGPT desktop app. Select7For Git repositories, [scheduled tasks](https://learn.chatgpt.com/docs/automations) can run on dedicated background worktrees so they don't conflict with your ongoing work. In non-version-controlled projects, scheduled tasks run directly in the project directory. You can also start chats in a worktree manually and use Handoff to move a chat between Local and Worktree.

8 **Codex** before you start a chat in a worktree.8 

9Worktrees don't run locally on your phone. With Remote, the mobile app

10 controls Codex on your connected computer, where the repository and worktree

11 remain, or in the remote development environment that computer uses. The

12 desktop-specific instructions below apply on the connected computer.

9 13 

10## What's a worktree14## What's a worktree

11 15 

Details

154 154 

155<ContentModeSwitch group="codex-surface" ids="app,cli,ide">155<ContentModeSwitch group="codex-surface" ids="app,cli,ide">

156 156 

157If you don't pin a model or `model_reasoning_effort`, Codex can choose a setup157If you don't configure a subagent model or `model_reasoning_effort`, the

158that balances intelligence, speed, and price for the task. It may favor `gpt-5.6-terra` for fast scans or a higher-effort `gpt-5.6` configuration for more demanding reasoning. When you want finer control, steer that choice in your prompt or set `model` and `model_reasoning_effort` directly in the agent file.158subagent inherits the parent agent's model and reasoning effort. If an explicit

159spawn request or an `[agents]` default selects a model without an

160explicit or configured reasoning effort, the subagent uses that model's default

161reasoning effort. To balance intelligence, speed, and price for each task,

162request a specific model or reasoning effort in your prompt,

163configure `[agents]` defaults in `config.toml`, or set `model` and

164`model_reasoning_effort` directly in the custom agent file.

165For example, use `gpt-5.6-terra` for fast scans or a higher-effort `gpt-5.6` configuration for more demanding reasoning.

159 166 

160For most tasks in Codex, start with 167For most tasks in Codex, start with

161 `gpt-5.6`. Use 168 `gpt-5.6`. Use


342- `developer_instructions`349- `developer_instructions`

343 350 

344If a custom agent file sets `model` or `model_reasoning_effort`, the value in351If a custom agent file sets `model` or `model_reasoning_effort`, the value in

345the file takes precedence. Otherwise, Codex resolves each setting independently:352the file takes precedence. Before applying the file, Codex resolves each setting

346an explicit spawn value, then the corresponding `[agents]` default, then the353from an explicit spawn value, then the corresponding `[agents]` default, then

347parent's value. If a spawn selects a different model and neither an explicit nor354the parent's value. If an explicit spawn request or an `[agents]` default

348configured effort is present, Codex uses that model's default effort. Other355selects a model and neither supplies a reasoning effort, Codex uses

349session settings, such as `sandbox_mode`, `mcp_servers`, and `skills.config`,356that model's default effort. A custom agent file that sets only `model`

350inherit from the parent when the custom agent file omits them.357preserves this previously resolved effort. Set `model_reasoning_effort` in the

358file too if the selected model doesn't support that effort or you want a

359different one. Other session settings, such as `sandbox_mode`, `mcp_servers`,

360and `skills.config`, inherit from the parent when the custom agent file omits

361them.

351 362 

352### Global settings363### Global settings

353 364 

import.md +2 −2

Details

81## What ChatGPT can import81## What ChatGPT can import

82 82 

83| Imported item | Destination |83| Imported item | Destination |

84| --------------------------------- | ---------------------------------------------------- |84| --------------------------------- | ------------------------------------------------------- |

85| Instruction files | [`AGENTS.md`](https://learn.chatgpt.com/docs/agent-configuration/agents-md) |85| Instruction files | [`AGENTS.md`](https://learn.chatgpt.com/docs/agent-configuration/agents-md) |

86| `settings.json` | [`config.toml`](https://learn.chatgpt.com/docs/config-file/config-basic) |86| `settings.json` | [`config.toml`](https://learn.chatgpt.com/docs/config-file/config-basic) |

87| Skills | [Skills](https://learn.chatgpt.com/docs/build-skills) |87| Skills | [Skills](https://learn.chatgpt.com/docs/build-skills) |


92| MCP server configuration | [Codex MCP configuration](https://learn.chatgpt.com/docs/extend/mcp) |92| MCP server configuration | [Codex MCP configuration](https://learn.chatgpt.com/docs/extend/mcp) |

93| Hooks | [Codex hooks](https://learn.chatgpt.com/docs/hooks) |93| Hooks | [Codex hooks](https://learn.chatgpt.com/docs/hooks) |

94| Slash commands | [Skills](https://learn.chatgpt.com/docs/build-skills) |94| Slash commands | [Skills](https://learn.chatgpt.com/docs/build-skills) |

95| Subagents | [Codex agents](https://learn.chatgpt.com/docs/agent-configuration/subagents) |95| Subagents | [Codex subagents](https://learn.chatgpt.com/docs/agent-configuration/subagents) |

96 96 

97## Finish setup after importing97## Finish setup after importing

98 98 

security/cli.md +26 −1

Details

33npx @openai/codex-security info --json33npx @openai/codex-security info --json

34```34```

35 35 

36See the [CLI and SDK releases](https://github.com/openai/codex-security/releases)

37for package changes.

38 

36List the available commands:39List the available commands:

37 40 

38```bash41```bash


129plain progress lines instead. CI and terminals without an interactive session132plain progress lines instead. CI and terminals without an interactive session

130use plain progress automatically.133use plain progress automatically.

131 134 

135The dashboard also shows live session details. These can contain source code

136or credentials, so review them before sharing.

137 

132By default, the CLI writes scan progress and its completion summary to stderr.138By default, the CLI writes scan progress and its completion summary to stderr.

133It doesn't print the full scan result to stdout. A completed scan prints a139It doesn't print the full scan result to stdout. A completed scan prints a

134summary like this:140summary like this:


164 --effort high170 --effort high

165```171```

166 172 

167Supported effort levels are `minimal`, `low`, `medium`, `high`, and `xhigh`.173Supported effort levels are `minimal`, `low`, `medium`, `high`, `xhigh`, and

174`max`.

168 175 

169## Review the results176## Review the results

170 177 


194The [CLI reference](https://learn.chatgpt.com/docs/security/cli/reference#scan-artifacts) describes201The [CLI reference](https://learn.chatgpt.com/docs/security/cli/reference#scan-artifacts) describes

195the full artifact and output contract.202the full artifact and output contract.

196 203 

204## Review and patch findings

205 

206After a complete interactive scan with findings, the CLI offers a finding

207browser. Review the evidence and choose which findings to fix. You can find

208the saved tasks in the Codex desktop app.

209 

210To patch high and critical findings without the browser:

211 

212```bash

213npx @openai/codex-security scan "$REPOSITORY" \

214 --patch --patch-severity high --json

215```

216 

217Add `--create-pr` to commit verified patches and open a GitHub pull request.

218 

219You can also patch saved findings or import Linear issues. See the

220[`validate` and `patch` reference](https://learn.chatgpt.com/docs/security/cli/reference#codex-security-validate-and-codex-security-patch).

221 

197## Choose the next scan222## Choose the next scan

198 223 

199Use a path scan when a repository contains separate services or packages:224Use a path scan when a repository contains separate services or packages:

Details

118 [--subagents N] [--stop-after-no-new N]118 [--subagents N] [--stop-after-no-new N]

119 [--max-discovery-runs N] [--max-time-hours HOURS]119 [--max-discovery-runs N] [--max-time-hours HOURS]

120 [--model MODEL]120 [--model MODEL]

121 [--effort {minimal,low,medium,high,xhigh}]121 [--effort {minimal,low,medium,high,xhigh,max}]

122 [--output-dir DIR]122 [--output-dir DIR]

123 [--archive-existing]123 [--archive-existing]

124 [--plugin-path PATH] [--python PATH]124 [--plugin-path PATH] [--python PATH]

125 [--codex KEY=VALUE] [--fail-on-severity LEVEL]125 [--codex KEY=VALUE] [--fail-on-severity LEVEL]

126 [--patch] [--patch-severity {critical,high,medium,low}]

127 [--create-pr]

126 [--max-cost USD] [--dry-run] [--headless] [--verbose]128 [--max-cost USD] [--dry-run] [--headless] [--verbose]

127 [--json] [--format {toon,json,yaml,jsonl}]129 [--json] [--format {toon,json,yaml,jsonl}]

128 [--full-output] [repository]130 [--full-output] [repository]


337| `--output-dir DIR` | Write scan artifacts to a private directory outside the enclosing Git worktree. Defaults to persistent Codex Security state. |339| `--output-dir DIR` | Write scan artifacts to a private directory outside the enclosing Git worktree. Defaults to persistent Codex Security state. |

338| `--archive-existing` | Move existing results to `DIR.previous-<timestamp>-<id>` and start with an empty output directory. Requires `--output-dir`. |340| `--archive-existing` | Move existing results to `DIR.previous-<timestamp>-<id>` and start with an empty output directory. Requires `--output-dir`. |

339| `--fail-on-severity LEVEL` | Return exit `1` when a completed scan reports a finding at or above `critical`, `high`, `medium`, or `low`. |341| `--fail-on-severity LEVEL` | Return exit `1` when a completed scan reports a finding at or above `critical`, `high`, `medium`, or `low`. |

342| `--patch` | Fix and verify selected findings after a complete scan. |

343| `--patch-severity LEVEL` | Patch findings at or above `critical`, `high`, `medium`, or `low`. Defaults to `low`. |

344| `--create-pr` | Commit verified patch files and open a GitHub pull request. Requires `--patch`. |

340| `--max-cost USD` | Stop a scan when its estimated model cost exceeds the specified USD amount. |345| `--max-cost USD` | Stop a scan when its estimated model cost exceeds the specified USD amount. |

341| `--dry-run` | Check the repository, target, knowledge base, output directory, and Codex configuration without starting a scan. |346| `--dry-run` | Check the repository, target, knowledge base, output directory, and Codex configuration without starting a scan. |

342| `--headless` | Show plain-text progress instead of the interactive scan dashboard. |347| `--headless` | Show plain-text progress instead of the interactive scan dashboard. |


406| `--auth {auto,chatgpt,api-key}` | Select the scan credentials. The default is `auto`. |411| `--auth {auto,chatgpt,api-key}` | Select the scan credentials. The default is `auto`. |

407| `--provider {openai,openrouter,fireworks,amazon-bedrock}` | Select the inference provider. The default is `openai`. |412| `--provider {openai,openrouter,fireworks,amazon-bedrock}` | Select the inference provider. The default is `openai`. |

408| `--model MODEL` | Select the model. The default is `gpt-5.6-sol`. Required for OpenRouter, Fireworks, and Amazon Bedrock. |413| `--model MODEL` | Select the model. The default is `gpt-5.6-sol`. Required for OpenRouter, Fireworks, and Amazon Bedrock. |

409| `--effort {minimal,low,medium,high,xhigh}` | Select the model's reasoning effort. The default is `xhigh`. |414| `--effort {minimal,low,medium,high,xhigh,max}` | Select the model's reasoning effort. The default is `xhigh`. |

410| `--plugin-path PATH` | Use a Codex Security plugin directory or ZIP to override the bundled plugin. |415| `--plugin-path PATH` | Use a Codex Security plugin directory or ZIP to override the bundled plugin. |

411| `--python PATH` | Select the Python interpreter for the plugin runtime. |416| `--python PATH` | Select the Python interpreter for the plugin runtime. |

412| `--codex KEY=VALUE` | Override an isolated Codex configuration value. Values use TOML syntax. Repeat the flag for more values. |417| `--codex KEY=VALUE` | Override an isolated Codex configuration value. Values use TOML syntax. Repeat the flag for more values. |


455 [--workers N] [--mode {standard,deep}]460 [--workers N] [--mode {standard,deep}]

456 [--provider {openai,openrouter,fireworks,amazon-bedrock}]461 [--provider {openai,openrouter,fireworks,amazon-bedrock}]

457 [--model MODEL]462 [--model MODEL]

458 [--effort {minimal,low,medium,high,xhigh}]463 [--effort {minimal,low,medium,high,xhigh,max}]

459 [--knowledge-base PATH]464 [--knowledge-base PATH]

460 [--scan-prompt-file FILE]465 [--scan-prompt-file FILE]

461 [--post-scan-prompt-file FILE]466 [--post-scan-prompt-file FILE]


801 "Missing authorization check in src/routes.ts:18"806 "Missing authorization check in src/routes.ts:18"

802```807```

803 808 

804Each argument can contain literal text or point to a file. Both commands work809Each positional argument accepts literal text or a file path. These inputs use

805against the current directory. Use `validate` to directly recheck an original810the current directory. Use `validate` to recheck a finding after a fix or when a

806finding after a fix or when a later scan no longer reports it. A scan811later scan no longer reports it. Comparing scans alone doesn't prove that a fix

807comparison alone doesn't prove that a fix worked. External tools can use these812worked.

808commands without rebuilding the scanner.

809 813 

810Use `--effort` to select reasoning effort for either command:814Use `--effort` to select reasoning effort for either command:

811 815 


813npx @openai/codex-security validate "Possible SQL injection" --effort high817npx @openai/codex-security validate "Possible SQL injection" --effort high

814```818```

815 819 

820### Patch findings after a scan

821 

822Use `scan --patch` to fix findings after a complete scan. This requires

823`@openai/codex-security` 0.1.15 or later. The default severity threshold is

824`low`. This command selects high and critical findings:

825 

826```bash

827npx @openai/codex-security scan . --patch --patch-severity high --json

828```

829 

830Verified and already-fixed findings don't trigger `--fail-on-severity`.

831 

832### Patch saved findings

833 

834Pass a finding or occurrence ID to patch its original repository, or select

835findings from a saved scan:

836 

837```bash

838npx @openai/codex-security patch OCCURRENCE_ID

839npx @openai/codex-security patch --scan SCAN_ID --severity high --json

840npx @openai/codex-security patch --scan latest --severity medium

841```

842 

843`--scan latest` selects the latest completed scan for the current repository.

844Saved-finding commands support `--json`; literal-text and file inputs don't.

845 

846Add `--create-pr` to commit only verified patch files and open a pull request

847with the GitHub CLI:

848 

849```bash

850npx @openai/codex-security patch --scan SCAN_ID --severity high --create-pr

851```

852 

853If the push or pull request fails, run the printed `patch --resume-pr BRANCH`

854command from the same repository to retry.

855 

856### Patch Linear issues

857 

858Set `CODEX_SECURITY_LINEAR_API_KEY` or `LINEAR_API_KEY` for a personal API key,

859or `LINEAR_ACCESS_TOKEN` for an OAuth token. Prefer an environment variable to

860`--linear-api-key KEY` to keep the key out of shell history.

861 

862Import an issue by ID or URL. Repeat `--linear-issue` to select more than one

863issue:

864 

865```bash

866npx @openai/codex-security patch --linear-issue SEC-123 --linear-issue SEC-124

867```

868 

869Use `--linear-project` to select a project's open issues. Add `--linear-filter`

870to narrow the selection:

871 

872```bash

873npx @openai/codex-security patch --linear-project "Security backlog" \

874 --linear-filter '{"labels":{"name":{"eq":"security"}}}'

875```

876 

877The CLI excludes completed and canceled issues unless the filter sets `state`.

878It doesn't change the Linear issues.

879 

816## `codex-security login`, `logout`, and `info`880## `codex-security login`, `logout`, and `info`

817 881 

818Sign in interactively:882Sign in interactively:


875npx @openai/codex-security scan . --headless939npx @openai/codex-security scan . --headless

876```940```

877 941 

942The dashboard also shows live session details. They aren't redacted and can

943contain source code or credentials. Review them before sharing.

944 

878### Verbose diagnostics945### Verbose diagnostics

879 946 

880Add `--verbose` to print redacted lifecycle, authentication, progress, and cost947Add `--verbose` to print redacted lifecycle, authentication, progress, and cost


932 usage999 usage

933```1000```

934 1001 

1002When [patching](#patch-findings-after-a-scan), JSON output also includes patch

1003results and any created pull request.

1004 

935Progress, completion summaries, archive notices, and errors remain on stderr.1005Progress, completion summaries, archive notices, and errors remain on stderr.

936A completed scan still prints the full JSON result when a severity policy1006A completed scan still prints the full JSON result when a severity policy

937returns exit `1` or incomplete coverage returns exit `2`.1007returns exit `1` or incomplete coverage returns exit `2`.

security/sdk.md +11 −0

Details

307}307}

308```308```

309 309 

310Findings can include optional `codeEvidence`, `rootCause`, `validation`,

311`attackPath`, `remediationTests`, and `preventiveControls` fields.

312 

310For repository-wide findings, `confirmedInLatestScan` distinguishes findings313For repository-wide findings, `confirmedInLatestScan` distinguishes findings

311seen in the latest scan from earlier findings that remain open:314seen in the latest scan from earlier findings that remain open:

312 315 


341 onWorkerStatus(status) {344 onWorkerStatus(status) {

342 console.log(status.kind, status);345 console.log(status.kind, status);

343 },346 },

347 onSessionEvent(session) {

348 console.log(session.threadId, session.worker, session.event["type"]);

349 },

344 onReconnect(attempt, maxAttempts) {350 onReconnect(attempt, maxAttempts) {

345 console.log(`Reconnect attempt ${attempt} of ${maxAttempts}`);351 console.log(`Reconnect attempt ${attempt} of ${maxAttempts}`);

346 },352 },


394| `onActivity(activity)` | A command, tool, reasoning step, or message updates. |400| `onActivity(activity)` | A command, tool, reasoning step, or message updates. |

395| `onProgress(progress)` | The scan phase or reviewed file count changes. |401| `onProgress(progress)` | The scan phase or reviewed file count changes. |

396| `onWorkerStatus(status)` | Worker preflight or dispatch status changes. |402| `onWorkerStatus(status)` | Worker preflight or dispatch status changes. |

403| `onSessionEvent(session)` | A scan or worker session emits an event. |

397| `onCost(cost)` | An updated estimated scan cost is available. |404| `onCost(cost)` | An updated estimated scan cost is available. |

398| `onWarning(warning)` | The scan reports a warning. |405| `onWarning(warning)` | The scan reports a warning. |

399| `onObserverError(observer, error)` | Another scan lifecycle callback raises an error. |406| `onObserverError(observer, error)` | Another scan lifecycle callback raises an error. |


401Trusted Access status is `granted`, `not_granted`, or `unknown`. Missing or408Trusted Access status is `granted`, `not_granted`, or `unknown`. Missing or

402unknown access also triggers `onWarning`.409unknown access also triggers `onWarning`.

403 410 

411`onSessionEvent` receives events that aren't redacted and can contain source

412code or credentials. Filter them before sending them to shared logs or other

413services.

414 

404## Configure the runtime and credentials415## Configure the runtime and credentials

405 416 

406Pass runtime configuration when you need a specific plugin, interpreter, or417Pass runtime configuration when you need a specific plugin, interpreter, or

subagents.md +19 −8

Details

154 154 

155<ContentModeSwitch group="codex-surface" ids="app,cli,ide">155<ContentModeSwitch group="codex-surface" ids="app,cli,ide">

156 156 

157If you don't pin a model or `model_reasoning_effort`, Codex can choose a setup157If you don't configure a subagent model or `model_reasoning_effort`, the

158that balances intelligence, speed, and price for the task. It may favor `gpt-5.6-terra` for fast scans or a higher-effort `gpt-5.6` configuration for more demanding reasoning. When you want finer control, steer that choice in your prompt or set `model` and `model_reasoning_effort` directly in the agent file.158subagent inherits the parent agent's model and reasoning effort. If an explicit

159spawn request or an `[agents]` default selects a model without an

160explicit or configured reasoning effort, the subagent uses that model's default

161reasoning effort. To balance intelligence, speed, and price for each task,

162request a specific model or reasoning effort in your prompt,

163configure `[agents]` defaults in `config.toml`, or set `model` and

164`model_reasoning_effort` directly in the custom agent file.

165For example, use `gpt-5.6-terra` for fast scans or a higher-effort `gpt-5.6` configuration for more demanding reasoning.

159 166 

160For most tasks in Codex, start with 167For most tasks in Codex, start with

161 `gpt-5.6`. Use 168 `gpt-5.6`. Use


342- `developer_instructions`349- `developer_instructions`

343 350 

344If a custom agent file sets `model` or `model_reasoning_effort`, the value in351If a custom agent file sets `model` or `model_reasoning_effort`, the value in

345the file takes precedence. Otherwise, Codex resolves each setting independently:352the file takes precedence. Before applying the file, Codex resolves each setting

346an explicit spawn value, then the corresponding `[agents]` default, then the353from an explicit spawn value, then the corresponding `[agents]` default, then

347parent's value. If a spawn selects a different model and neither an explicit nor354the parent's value. If an explicit spawn request or an `[agents]` default

348configured effort is present, Codex uses that model's default effort. Other355selects a model and neither supplies a reasoning effort, Codex uses

349session settings, such as `sandbox_mode`, `mcp_servers`, and `skills.config`,356that model's default effort. A custom agent file that sets only `model`

350inherit from the parent when the custom agent file omits them.357preserves this previously resolved effort. Set `model_reasoning_effort` in the

358file too if the selected model doesn't support that effort or you want a

359different one. Other session settings, such as `sandbox_mode`, `mcp_servers`,

360and `skills.config`, inherit from the parent when the custom agent file omits

361them.

351 362 

352### Global settings363### Global settings

353 364