SpyBara
Go Premium

Documentation 2026-11-18 22:59 UTC to 2026-11-19 23:02 UTC

3 files changed +391 −1. View all changes and history on the product overview
2026
Thu 26 23:00 Wed 25 23:02 Tue 24 23:01 Mon 23 23:58 Fri 20 23:59 Thu 19 23:02 Wed 18 22:59 Tue 17 22:59 Mon 16 23:00 Sun 15 23:01 Sat 14 23:01 Fri 13 23:58 Thu 12 22:58 Wed 11 23:00 Tue 10 23:57 Mon 9 23:02 Fri 6 23:02 Thu 5 23:03 Wed 4 23:02 Tue 3 23:57 Mon 2 23:02

app-server.md +148 −0

Details

217});217});

218```218```

219 219 

220```go

221package main

222 

223import (

224 "bufio"

225 "context"

226 "encoding/json"

227 "fmt"

228 "log"

229 "os"

230 "os/exec"

231 "path/filepath"

232 "time"

233)

234 

235func run() error {

236 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)

237 defer cancel()

238 directory, err := os.MkdirTemp("", "codex-app-server-")

239 if err != nil {

240 return err

241 }

242 defer os.RemoveAll(directory)

243 for name, content := range map[string]string{"README.md": "A small Go project with a greeting program.\n", "hello.go": "package main\nimport \"fmt\"\nfunc main(){fmt.Println(\"Hello, world!\")}\n"} {

244 if err := os.WriteFile(filepath.Join(directory, name), []byte(content), 0600); err != nil {

245 return err

246 }

247 }

248 if output, err := exec.CommandContext(ctx, "git", "init", "--quiet", directory).CombinedOutput(); err != nil {

249 return fmt.Errorf("git init: %w: %s", err, output)

250 }

251 command := exec.CommandContext(ctx, "codex", "app-server")

252 command.Dir = directory

253 command.Stderr = os.Stderr

254 stdin, err := command.StdinPipe()

255 if err != nil {

256 return err

257 }

258 stdout, err := command.StdoutPipe()

259 if err != nil {

260 return err

261 }

262 if err := command.Start(); err != nil {

263 return err

264 }

265 defer func() {

266 stdin.Close()

267 if command.ProcessState == nil {

268 command.Process.Kill()

269 command.Wait()

270 }

271 }()

272 encoder := json.NewEncoder(stdin)

273 send := func(message map[string]any) error { return encoder.Encode(message) }

274 if err := send(map[string]any{"method": "initialize", "id": 0, "params": map[string]any{"clientInfo": map[string]string{"name": "my_product", "title": "My Product", "version": "0.1.0"}}}); err != nil {

275 return err

276 }

277 scanner := bufio.NewScanner(stdout)

278 scanner.Buffer(make([]byte, 4096), 8<<20)

279 var threadID, turnID string

280 completed := false

281 for scanner.Scan() {

282 line := scanner.Bytes()

283 var message struct {

284 ID *int `json:"id"`

285 Method string `json:"method"`

286 Error json.RawMessage `json:"error"`

287 Result struct {

288 Thread struct {

289 ID string `json:"id"`

290 } `json:"thread"`

291 Turn struct {

292 ID string `json:"id"`

293 } `json:"turn"`

294 } `json:"result"`

295 Params struct {

296 ThreadID string `json:"threadId"`

297 Turn struct {

298 ID string `json:"id"`

299 Status string `json:"status"`

300 Error json.RawMessage `json:"error"`

301 } `json:"turn"`

302 } `json:"params"`

303 }

304 if err := json.Unmarshal(line, &message); err != nil {

305 return err

306 }

307 fmt.Println(string(line))

308 if len(message.Error) > 0 && string(message.Error) != "null" {

309 return fmt.Errorf("app-server error: %s", message.Error)

310 }

311 switch {

312 case message.Method != "" && message.ID != nil:

313 return fmt.Errorf("this minimal client cannot handle server request %q", message.Method)

314 case message.ID != nil && *message.ID == 0:

315 if err := send(map[string]any{"method": "initialized", "params": map[string]any{}}); err != nil {

316 return err

317 }

318 if err := send(map[string]any{"method": "thread/start", "id": 1, "params": map[string]any{"model": "gpt-6.1-sol"}}); err != nil {

319 return err

320 }

321 case message.ID != nil && *message.ID == 1:

322 threadID = message.Result.Thread.ID

323 if threadID == "" {

324 return fmt.Errorf("missing thread ID")

325 }

326 if err := send(map[string]any{"method": "turn/start", "id": 2, "params": map[string]any{"threadId": threadID, "effort": "low", "input": []map[string]string{{"type": "text", "text": "Summarize this repo."}}}}); err != nil {

327 return err

328 }

329 case message.ID != nil && *message.ID == 2:

330 turnID = message.Result.Turn.ID

331 if turnID == "" {

332 return fmt.Errorf("missing turn ID")

333 }

334 case message.Method == "turn/completed":

335 if message.Params.ThreadID != threadID || turnID == "" || message.Params.Turn.ID != turnID {

336 return fmt.Errorf("expected matching completed turn")

337 }

338 if message.Params.Turn.Status != "completed" {

339 return fmt.Errorf("app-server turn %s: %s", message.Params.Turn.Status, message.Params.Turn.Error)

340 }

341 completed = true

342 }

343 if completed {

344 break

345 }

346 }

347 if err := scanner.Err(); err != nil {

348 return err

349 }

350 if err := stdin.Close(); err != nil {

351 return err

352 }

353 if err := command.Wait(); err != nil {

354 return err

355 }

356 if !completed {

357 return fmt.Errorf("app-server closed before the turn completed")

358 }

359 return nil

360}

361func main() {

362 if err := run(); err != nil {

363 log.Fatal(err)

364 }

365}

366```

367 

220```ruby368```ruby

221require "json"369require "json"

222require "open3"370require "open3"

developer-settings.md +207 −0 created

Details

1# Developer settings

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.

4 

5<ContentModeSwitch group="codex-surface" id="web">

6 

7ChatGPT web stores product and workspace preferences in ChatGPT settings. ChatGPT Work

8chats run in a managed environment and don't read local Codex

9configuration files. Use the controls your workspace exposes in ChatGPT

10settings; workspace administrators may manage some settings for you.

11 

12</ContentModeSwitch>

13 

14<ContentModeSwitch group="codex-surface" id="app">

15 

16The general [Settings](https://learn.chatgpt.com/docs/reference/settings) page covers app preferences,

17including profile, keyboard shortcuts, notifications, appearance,

18personalization, memories, and archived chats.

19 

20## Project and terminal behavior

21 

22Choose where files open, how much command output appears in chats, and where

23terminal tabs open by default.

24 

25## Code review

26 

27Under **Settings > Git**, use **Review delivery** to choose **Inline** to run

28`/review` in the current chat when possible or **Detached** to start a separate

29review chat.

30 

31## IDE extension sync

32 

33When the ChatGPT desktop app and IDE extension are open in the same project,

34they share active chats and editor context. Turn on **IDE context** from the app

35composer to let Codex use files currently open in your editor. Turn it off when

36you want the app prompt to exclude that editor context.

37 

38You can open an app chat from the IDE extension and continue an IDE chat in the

39app. Both surfaces use the same project to determine which chats and context to

40share.

41 

42## Agent configuration

43 

44Codex agents in the app inherit the same configuration as the IDE extension and

45CLI. Use the in-app controls for common settings, or edit `config.toml` for

46advanced options. See [Agent approvals and security](https://learn.chatgpt.com/docs/agent-approvals-security)

47and [Config basics](https://learn.chatgpt.com/docs/config-file/config-basic) for details.

48 

49## Git

50 

51Use Git settings to standardize branch naming and choose whether Codex uses

52force pushes. You can also set prompts that Codex uses to generate commit

53messages and pull request descriptions.

54 

55## Integrations and MCP

56 

57Connect external tools through Model Context Protocol (MCP). Enable recommended

58servers or add your own. If a server requires OAuth, the app starts the

59authentication flow. These settings also apply to the Codex CLI and IDE

60extension because MCP configuration lives in `config.toml`. See

61[Model Context Protocol](https://learn.chatgpt.com/docs/extend/mcp) for details.

62 

63## Browser developer mode

64 

65Under **Developer mode**, turn on **Enable full CDP access** to let ChatGPT use

66the Chrome DevTools Protocol for performance profiling and deeper browser

67debugging. If your organization has disabled full CDP access, you can't enable

68it locally. See [Developer mode](https://learn.chatgpt.com/docs/browser?surface=app#app-developer-mode) for setup,

69risk, approval, and administrator requirements.

70 

71</ContentModeSwitch>

72 

73<ContentModeSwitch group="codex-surface" id="cli">

74 

75Codex CLI reads your personal defaults from `~/.codex/config.toml`. Add a

76`.codex/config.toml` file to a trusted project or subfolder when you need

77project-specific overrides. The CLI and IDE extension share these configuration

78layers.

79 

80## Inspect your settings

81 

82Use these commands to understand the effective settings for the current

83session:

84 

85- Run `/status` to see the active model, approval policy, writable roots, and

86 token usage.

87- Run `/debug-config` to see the configuration layers in precedence order and

88 the source of managed policy requirements.

89- Start Codex with `--strict-config` to treat unrecognized `config.toml` keys as

90 errors instead of ignoring them.

91 

92See [Developer commands](https://learn.chatgpt.com/docs/developer-commands?surface=cli) for the full

93interactive command reference.

94 

95## Change settings for one run

96 

97Use a dedicated flag when one exists. Common examples include `--model`,

98`--sandbox`, `--ask-for-approval`, `--profile`, and `--search`. Use `-c` or

99`--config` to override any supported configuration key for one run.

100 

101The model override below requires GPT-6.2 Sol access. If it isn't available to

102your account or workspace, omit `--model` or choose a model listed by `/model`.

103See [model availability by plan](https://learn.chatgpt.com/docs/pricing#feature-availability).

104 

105```bash

106codex --model gpt-6.2-sol

107codex --profile deep-review

108codex --config model_reasoning_effort='"medium"'

109```

110 

111 

112Command-line flags and `--config` values have the highest precedence. For the

113complete flag list, see [Developer commands](https://learn.chatgpt.com/docs/developer-commands?surface=cli).

114 

115## Configuration layers

116 

117The CLI applies command-line flags and `--config` overrides before project,

118profile, user, system, and built-in settings. Use that precedence to keep shared

119defaults in configuration files and one-off changes on the command line.

120 

121For the complete order and common options, see [Config basics](https://learn.chatgpt.com/docs/config-file/config-basic).

122 

123## Change settings in the TUI

124 

125The interactive terminal UI provides pickers for common session and display

126settings:

127 

128| Goal | Command | Related configuration |

129| ------------------------- | -------------------------------------------- | ---------------------------------------------- |

130| Choose a terminal mode | `/tui` | `tui.fullscreen_transcript` (restart required) |

131| Choose a model | `/model` | `model`, `model_reasoning_effort` |

132| Change permissions | `/permissions` | Approval and sandbox settings |

133| Configure optional tools | `/experimental`, `/memories` | Feature-specific `config.toml` keys |

134| Customize the terminal UI | `/keymap`, `/statusline`, `/title`, `/theme` | Keys under `[tui]` |

135| Set editing defaults | `/vim`, `/raw` | `tui.vim_mode_default`, `tui.raw_output_mode` |

136 

137In the full-screen transcript, open `/config`, choose **Sessions**, and turn on

138**Collapse turn details** to fold completed activity under each prompt. Final

139answers stay visible, and transcript search includes folded output. The setting

140is off by default.

141 

142Some commands apply only to the current session, while some pickers offer to

143save the choice. Set the related configuration key when you want a default for

144future sessions. For the terminal theme, editor, completions, and shortcut

145workflows, see [CLI customization](https://learn.chatgpt.com/docs/cli-customization).

146 

147## Settings references

148 

149- [Advanced configuration](https://learn.chatgpt.com/docs/config-file/config-advanced) covers profiles, one-off overrides, and other advanced workflows.

150- [Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference) lists the available keys and values.

151- [Sample configuration](https://learn.chatgpt.com/docs/config-file/config-sample) provides a complete example file.

152- [Environment variables](https://learn.chatgpt.com/docs/config-file/environment-variables) documents variables used by the CLI and installer.

153 

154</ContentModeSwitch>

155 

156<ContentModeSwitch group="codex-surface" id="ide">

157 

158The Codex IDE extension has two settings layers:

159 

160- **Codex settings** control agent behavior shared with Codex CLI, including the

161 model, reasoning effort, permissions, sandbox, MCP servers, and

162 personalization. Codex reads these settings from `config.toml`.

163- **Editor settings** control how the extension behaves inside VS Code and

164 compatible editors. These settings use `chatgpt.*` keys in the editor's

165 settings system.

166 

167## Open Codex settings

168 

169Select the gear icon in the Codex sidebar, then select **Codex Settings**. Use

170the settings panel for common agent controls, or select **Open config.toml** to

171edit the active configuration layer directly.

172 

173For the configuration layer order and common keys, see [Config

174basics](https://learn.chatgpt.com/docs/config-file/config-basic). For every supported `config.toml` key, see the

175[Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference).

176 

177## Change an editor setting

178 

179To change a setting, follow these steps:

180 

1811. Open your editor settings.

1822. Search for `@ext:openai.chatgpt`, `Codex`, or the setting name.

1833. Update the value.

184 

185The extension also honors VS Code's built-in chat font settings for Codex chat surfaces.

186 

187## Editor settings reference

188 

189| Setting | Default | Description |

190| -------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

191| `chatgpt.commentCodeLensEnabled` | `true` | Show CodeLens above `TODO` comments so Codex can address them. |

192| `chatgpt.openOnStartup` | `false` | Focus the Codex sidebar when the extension finishes starting. |

193| `chatgpt.followUpQueueMode` | `queue` | Choose whether messages sent during a run wait for the next run (`queue`) or steer the current run (`steer`). The extension treats the legacy `interrupt` value as `steer`. Press <kbd>Cmd</kbd>/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd> to invert the behavior for one message. |

194| `chatgpt.composerEnterBehavior` | `enter` | Choose whether <kbd>Enter</kbd> always sends (`enter`), <kbd>Cmd</kbd>/<kbd>Ctrl</kbd>+<kbd>Enter</kbd> sends multiline prompts (`cmdIfMultiline`), or the modifier is always required (`cmdAlways`). |

195| `chatgpt.reviewDelivery` | `inline` | Run `/review` in the current chat when possible (`inline`) or start a separate review chat (`detached`). |

196| `chatgpt.localeOverride` | Auto | Set the preferred language for the Codex UI. Leave empty to detect it automatically. |

197| `chatgpt.runCodexInWindowsSubsystemForLinux` | `false` | Windows only: Run Codex in WSL when WSL is available. Use this when your repositories and tooling live in WSL2 or when you need Linux-native tooling. Changing this setting reloads VS Code. |

198| `chatgpt.cliExecutable` | Unset | Development only: Set the path to the Codex CLI executable. You don't need this setting unless you're developing the Codex CLI; manually overriding the bundled executable can prevent parts of the extension from working. |

199| `chat.fontSize` | Editor default | Control chat text in the Codex sidebar, including chat content and the composer. |

200| `chat.editor.fontSize` | Editor default | Control code-rendered content in Codex chats, including code snippets and diffs. |

201 

202The `chatgpt.*` keys above belong to the IDE extension and don't go in

203`config.toml`. For shared agent settings, use [Config

204basics](https://learn.chatgpt.com/docs/config-file/config-basic), [Advanced configuration](https://learn.chatgpt.com/docs/config-file/config-advanced),

205and the [Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference).

206 

207</ContentModeSwitch>

Details

1187 1187 

1188</CodeSampleNote>1188</CodeSampleNote>

1189 1189 

1190<CodeSampleNote client:load language="go" languages={Object.keys(samples.all.codexSecurityCookbook.installAndEnforceAdministratorManagedHooks())}>

1191 

1192Save the Go version as `main.go` in a Go module and build it with `go build -o pre_tool_use_policy .`. Have an administrator install the executable as `/etc/codex/hooks/pre_tool_use_policy` with root ownership and mode `755`, and set the hook `command` to that absolute path. It uses only the standard library and does not need an interpreter.

1193 

1194</CodeSampleNote>

1195 

1190<CodeSampleNote client:load language="ruby" languages={Object.keys(samples.all.codexSecurityCookbook.installAndEnforceAdministratorManagedHooks())}>1196<CodeSampleNote client:load language="ruby" languages={Object.keys(samples.all.codexSecurityCookbook.installAndEnforceAdministratorManagedHooks())}>

1191 1197 

1192For a local macOS integration test, save the Ruby version as `pre_tool_use_policy.rb`. Set the hook `command` to `/usr/bin/ruby /etc/codex/hooks/pre_tool_use_policy.rb`, replacing `/usr/bin/ruby` with the absolute path to your Ruby interpreter if needed. The Ruby hook uses only the standard library.1198For a local macOS integration test, save the Ruby version as `pre_tool_use_policy.rb`. Set the hook `command` to `/usr/bin/ruby /etc/codex/hooks/pre_tool_use_policy.rb`, replacing `/usr/bin/ruby` with the absolute path to your Ruby interpreter if needed. The Ruby hook uses only the standard library.

1193 1199 

1194</CodeSampleNote>1200</CodeSampleNote>

1195 1201 

1196It blocks only the synthetic marker; replace it with a reviewed organization-specific policy before relying on it. Confirm that the configured interpreter exists on the target. The filename and interpreter must match the selected language:1202It blocks only the synthetic marker; replace it with a reviewed organization-specific policy before relying on it. Confirm that the configured executable and any required interpreter exist on the target. The command must match the selected language:

1197 1203 

1198Define a managed hook policy1204Define a managed hook policy

1199 1205 


1208 sys.exit(2)1214 sys.exit(2)

1209```1215```

1210 1216 

1217```go

1218package main

1219 

1220import (

1221 "encoding/json"

1222 "fmt"

1223 "io"

1224 "os"

1225 "strings"

1226)

1227 

1228func main() {

1229 var event struct {

1230 ToolInput struct {

1231 Command string `json:"command"`

1232 } `json:"tool_input"`

1233 }

1234 decoder := json.NewDecoder(io.LimitReader(os.Stdin, 1<<20))

1235 if err := decoder.Decode(&event); err != nil {

1236 fmt.Fprintln(os.Stderr, "Invalid hook event.")

1237 os.Exit(2)

1238 }

1239 if strings.Contains(event.ToolInput.Command, "CODEX_HOOK_TEST_DENY") {

1240 fmt.Fprintln(os.Stderr, "Synthetic test command blocked by managed hook.")

1241 os.Exit(2)

1242 }

1243}

1244```

1245 

1211```ruby1246```ruby

1212require "json"1247require "json"

1213 1248