Skip to content

Commit ab63a47

Browse files
authored
docs: add example config.toml (#5175)
I was missing an example config.toml, and following docs/config.md alone was slower. I had GPT-5 scan the codebase for every accepted config key, check the defaults, and generate a single example config.toml with annotations. It lists all keys Codex reads from TOML, sets each to its effective default where it exists, leaves optional ones commented, and adds short comments on purpose and valid values. This should make onboarding faster and reduce configuration errors. I can rename it to config.example.toml or move it under docs/ if you prefer.
1 parent e658c6c commit ab63a47

File tree

2 files changed

+375
-0
lines changed

2 files changed

+375
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Codex CLI supports a rich set of configuration options, with preferences stored
8181
- [Custom prompts](./docs/prompts.md)
8282
- [Memory with AGENTS.md](./docs/getting-started.md#memory-with-agentsmd)
8383
- [**Configuration**](./docs/config.md)
84+
- [Example config](./docs/example-config.md)
8485
- [**Sandbox & approvals**](./docs/sandbox.md)
8586
- [**Authentication**](./docs/authentication.md)
8687
- [Auth methods](./docs/authentication.md#forcing-a-specific-auth-method-advanced)

docs/example-config.md

Lines changed: 374 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,374 @@
1+
# Example config.toml
2+
3+
Use this example configuration as a starting point. For an explanation of each field and additional context, see [Configuration](./config.md). Copy the snippet below to `~/.codex/config.toml` and adjust values as needed.
4+
5+
```toml
6+
# Codex example configuration (config.toml)
7+
#
8+
# This file lists all keys Codex reads from config.toml, their default values,
9+
# and concise explanations. Values here mirror the effective defaults compiled
10+
# into the CLI. Adjust as needed.
11+
#
12+
# Notes
13+
# - Root keys must appear before tables in TOML.
14+
# - Optional keys that default to "unset" are shown commented out with notes.
15+
# - MCP servers, profiles, and model providers are examples; remove or edit.
16+
17+
################################################################################
18+
# Core Model Selection
19+
################################################################################
20+
21+
# Primary model used by Codex. Default differs by OS; non-Windows defaults here.
22+
# Linux/macOS default: "gpt-5-codex"; Windows default: "gpt-5".
23+
model = "gpt-5-codex"
24+
25+
# Model used by the /review feature (code reviews). Default: "gpt-5-codex".
26+
review_model = "gpt-5-codex"
27+
28+
# Provider id selected from [model_providers]. Default: "openai".
29+
model_provider = "openai"
30+
31+
# Optional manual model metadata. When unset, Codex auto-detects from model.
32+
# Uncomment to force values.
33+
# model_context_window = 128000 # tokens; default: auto for model
34+
# model_max_output_tokens = 8192 # tokens; default: auto for model
35+
# model_auto_compact_token_limit = 0 # disable/override auto; default: model family specific
36+
37+
################################################################################
38+
# Reasoning & Verbosity (Responses API capable models)
39+
################################################################################
40+
41+
# Reasoning effort: minimal | low | medium | high (default: medium)
42+
model_reasoning_effort = "medium"
43+
44+
# Reasoning summary: auto | concise | detailed | none (default: auto)
45+
model_reasoning_summary = "auto"
46+
47+
# Text verbosity for GPT-5 family (Responses API): low | medium | high (default: medium)
48+
model_verbosity = "medium"
49+
50+
# Force-enable reasoning summaries for current model (default: false)
51+
model_supports_reasoning_summaries = false
52+
53+
# Force reasoning summary format: none | experimental (default: none)
54+
model_reasoning_summary_format = "none"
55+
56+
################################################################################
57+
# Instruction Overrides
58+
################################################################################
59+
60+
# Additional user instructions appended after AGENTS.md. Default: unset.
61+
# developer_instructions = ""
62+
63+
# Optional legacy base instructions override (prefer AGENTS.md). Default: unset.
64+
# instructions = ""
65+
66+
# Inline override for the history compaction prompt. Default: unset.
67+
# compact_prompt = ""
68+
69+
# Override built-in base instructions with a file path. Default: unset.
70+
# experimental_instructions_file = "/absolute/or/relative/path/to/instructions.txt"
71+
72+
# Load the compact prompt override from a file. Default: unset.
73+
# experimental_compact_prompt_file = "/absolute/or/relative/path/to/compact_prompt.txt"
74+
75+
################################################################################
76+
# Approval & Sandbox
77+
################################################################################
78+
79+
# When to ask for command approval:
80+
# - untrusted: only known-safe read-only commands auto-run; others prompt
81+
# - on-failure: auto-run in sandbox; prompt only on failure for escalation
82+
# - on-request: model decides when to ask (default)
83+
# - never: never prompt (risky)
84+
approval_policy = "on-request"
85+
86+
# Filesystem/network sandbox policy for tool calls:
87+
# - read-only (default)
88+
# - workspace-write
89+
# - danger-full-access (no sandbox; extremely risky)
90+
sandbox_mode = "read-only"
91+
92+
# Extra settings used only when sandbox_mode = "workspace-write".
93+
[sandbox_workspace_write]
94+
# Additional writable roots beyond the workspace (cwd). Default: []
95+
writable_roots = []
96+
# Allow outbound network access inside the sandbox. Default: false
97+
network_access = false
98+
# Exclude $TMPDIR from writable roots. Default: false
99+
exclude_tmpdir_env_var = false
100+
# Exclude /tmp from writable roots. Default: false
101+
exclude_slash_tmp = false
102+
103+
################################################################################
104+
# Shell Environment Policy for spawned processes
105+
################################################################################
106+
107+
[shell_environment_policy]
108+
# inherit: all (default) | core | none
109+
inherit = "all"
110+
# Skip default excludes for names containing KEY/TOKEN (case-insensitive). Default: false
111+
ignore_default_excludes = false
112+
# Case-insensitive glob patterns to remove (e.g., "AWS_*", "AZURE_*"). Default: []
113+
exclude = []
114+
# Explicit key/value overrides (always win). Default: {}
115+
set = {}
116+
# Whitelist; if non-empty, keep only matching vars. Default: []
117+
include_only = []
118+
# Experimental: run via user shell profile. Default: false
119+
experimental_use_profile = false
120+
121+
################################################################################
122+
# History & File Opener
123+
################################################################################
124+
125+
[history]
126+
# save-all (default) | none
127+
persistence = "save-all"
128+
# Maximum bytes for history file (currently not enforced). Example: 5242880
129+
# max_bytes = 0
130+
131+
# URI scheme for clickable citations: vscode (default) | vscode-insiders | windsurf | cursor | none
132+
file_opener = "vscode"
133+
134+
################################################################################
135+
# UI, Notifications, and Misc
136+
################################################################################
137+
138+
[tui]
139+
# Desktop notifications from the TUI: boolean or filtered list. Default: false
140+
# Examples: true | ["agent-turn-complete", "approval-requested"]
141+
notifications = false
142+
143+
# Suppress internal reasoning events from output (default: false)
144+
hide_agent_reasoning = false
145+
146+
# Show raw reasoning content when available (default: false)
147+
show_raw_agent_reasoning = false
148+
149+
# Disable burst-paste detection in the TUI (default: false)
150+
disable_paste_burst = false
151+
152+
# Track Windows onboarding acknowledgement (Windows only). Default: false
153+
windows_wsl_setup_acknowledged = false
154+
155+
# External notifier program (argv array). When unset: disabled.
156+
# Example: notify = ["notify-send", "Codex"]
157+
# notify = [ ]
158+
159+
# In-product notices (mostly set automatically by Codex).
160+
[notice]
161+
# hide_full_access_warning = true
162+
163+
################################################################################
164+
# Authentication & Login
165+
################################################################################
166+
167+
# Where to persist CLI login credentials: file (default) | keyring | auto
168+
cli_auth_credentials_store = "file"
169+
170+
# Base URL for ChatGPT auth flow (not OpenAI API). Default:
171+
chatgpt_base_url = "https://chatgpt.com/backend-api/"
172+
173+
# Restrict ChatGPT login to a specific workspace id. Default: unset.
174+
# forced_chatgpt_workspace_id = ""
175+
176+
# Force login mechanism when Codex would normally auto-select. Default: unset.
177+
# Allowed values: chatgpt | api
178+
# forced_login_method = "chatgpt"
179+
180+
################################################################################
181+
# Project Documentation Controls
182+
################################################################################
183+
184+
# Max bytes from AGENTS.md to embed into first-turn instructions. Default: 32768
185+
project_doc_max_bytes = 32768
186+
187+
# Ordered fallbacks when AGENTS.md is missing at a directory level. Default: []
188+
project_doc_fallback_filenames = []
189+
190+
################################################################################
191+
# Tools (legacy toggles kept for compatibility)
192+
################################################################################
193+
194+
[tools]
195+
# Enable web search tool (alias: web_search_request). Default: false
196+
web_search = false
197+
198+
# Enable the view_image tool so the agent can attach local images. Default: true
199+
view_image = true
200+
201+
# (Alias accepted) You can also write:
202+
# web_search_request = false
203+
204+
################################################################################
205+
# Centralized Feature Flags (preferred)
206+
################################################################################
207+
208+
[features]
209+
# Leave this table empty to accept defaults. Set explicit booleans to opt in/out.
210+
unified_exec = false
211+
streamable_shell = false
212+
rmcp_client = false
213+
apply_patch_freeform = false
214+
view_image_tool = true
215+
web_search_request = false
216+
experimental_sandbox_command_assessment = false
217+
ghost_commit = false
218+
enable_experimental_windows_sandbox = false
219+
220+
################################################################################
221+
# Experimental toggles (legacy; prefer [features])
222+
################################################################################
223+
224+
# Use experimental exec command tool (streamable shell). Default: false
225+
experimental_use_exec_command_tool = false
226+
227+
# Use experimental unified exec tool. Default: false
228+
experimental_use_unified_exec_tool = false
229+
230+
# Use experimental Rust MCP client (enables OAuth for HTTP MCP). Default: false
231+
experimental_use_rmcp_client = false
232+
233+
# Include apply_patch via freeform editing path (affects default tool set). Default: false
234+
experimental_use_freeform_apply_patch = false
235+
236+
# Enable model-based sandbox command assessment. Default: false
237+
experimental_sandbox_command_assessment = false
238+
239+
################################################################################
240+
# MCP (Model Context Protocol) servers
241+
################################################################################
242+
243+
# Preferred store for MCP OAuth credentials: auto (default) | file | keyring
244+
mcp_oauth_credentials_store = "auto"
245+
246+
# Define MCP servers under this table. Leave empty to disable.
247+
[mcp_servers]
248+
249+
# --- Example: STDIO transport ---
250+
# [mcp_servers.docs]
251+
# command = "docs-server" # required
252+
# args = ["--port", "4000"] # optional
253+
# env = { "API_KEY" = "value" } # optional key/value pairs copied as-is
254+
# env_vars = ["ANOTHER_SECRET"] # optional: forward these from the parent env
255+
# cwd = "/path/to/server" # optional working directory override
256+
# startup_timeout_sec = 10.0 # optional; default 10.0 seconds
257+
# # startup_timeout_ms = 10000 # optional alias for startup timeout (milliseconds)
258+
# tool_timeout_sec = 60.0 # optional; default 60.0 seconds
259+
# enabled_tools = ["search", "summarize"] # optional allow-list
260+
# disabled_tools = ["slow-tool"] # optional deny-list (applied after allow-list)
261+
262+
# --- Example: Streamable HTTP transport ---
263+
# [mcp_servers.github]
264+
# url = "https://github-mcp.example.com/mcp" # required
265+
# bearer_token_env_var = "GITHUB_TOKEN" # optional; Authorization: Bearer <token>
266+
# http_headers = { "X-Example" = "value" } # optional static headers
267+
# env_http_headers = { "X-Auth" = "AUTH_ENV" } # optional headers populated from env vars
268+
# startup_timeout_sec = 10.0 # optional
269+
# tool_timeout_sec = 60.0 # optional
270+
# enabled_tools = ["list_issues"] # optional allow-list
271+
272+
################################################################################
273+
# Model Providers (extend/override built-ins)
274+
################################################################################
275+
276+
# Built-ins include:
277+
# - openai (Responses API; requires login or OPENAI_API_KEY via auth flow)
278+
# - oss (Chat Completions API; defaults to http://localhost:11434/v1)
279+
280+
[model_providers]
281+
282+
# --- Example: override OpenAI with explicit base URL or headers ---
283+
# [model_providers.openai]
284+
# name = "OpenAI"
285+
# base_url = "https://api.openai.com/v1" # default if unset
286+
# wire_api = "responses" # "responses" | "chat" (default varies)
287+
# # requires_openai_auth = true # built-in OpenAI defaults to true
288+
# # request_max_retries = 4 # default 4; max 100
289+
# # stream_max_retries = 5 # default 5; max 100
290+
# # stream_idle_timeout_ms = 300000 # default 300_000 (5m)
291+
# # experimental_bearer_token = "sk-example" # optional dev-only direct bearer token
292+
# # http_headers = { "X-Example" = "value" }
293+
# # env_http_headers = { "OpenAI-Organization" = "OPENAI_ORGANIZATION", "OpenAI-Project" = "OPENAI_PROJECT" }
294+
295+
# --- Example: Azure (Chat/Responses depending on endpoint) ---
296+
# [model_providers.azure]
297+
# name = "Azure"
298+
# base_url = "https://YOUR_PROJECT_NAME.openai.azure.com/openai"
299+
# wire_api = "responses" # or "chat" per endpoint
300+
# query_params = { api-version = "2025-04-01-preview" }
301+
# env_key = "AZURE_OPENAI_API_KEY"
302+
# # env_key_instructions = "Set AZURE_OPENAI_API_KEY in your environment"
303+
304+
# --- Example: Local OSS (e.g., Ollama-compatible) ---
305+
# [model_providers.ollama]
306+
# name = "Ollama"
307+
# base_url = "http://localhost:11434/v1"
308+
# wire_api = "chat"
309+
310+
################################################################################
311+
# Profiles (named presets)
312+
################################################################################
313+
314+
# Active profile name. When unset, no profile is applied.
315+
# profile = "default"
316+
317+
[profiles]
318+
319+
# [profiles.default]
320+
# model = "gpt-5-codex"
321+
# model_provider = "openai"
322+
# approval_policy = "on-request"
323+
# sandbox_mode = "read-only"
324+
# model_reasoning_effort = "medium"
325+
# model_reasoning_summary = "auto"
326+
# model_verbosity = "medium"
327+
# chatgpt_base_url = "https://chatgpt.com/backend-api/"
328+
# experimental_compact_prompt_file = "compact_prompt.txt"
329+
# include_apply_patch_tool = false
330+
# experimental_use_unified_exec_tool = false
331+
# experimental_use_exec_command_tool = false
332+
# experimental_use_rmcp_client = false
333+
# experimental_use_freeform_apply_patch = false
334+
# experimental_sandbox_command_assessment = false
335+
# tools_web_search = false
336+
# tools_view_image = true
337+
# features = { unified_exec = false }
338+
339+
################################################################################
340+
# Projects (trust levels)
341+
################################################################################
342+
343+
# Mark specific worktrees as trusted. Only "trusted" is recognized.
344+
[projects]
345+
# [projects."/absolute/path/to/project"]
346+
# trust_level = "trusted"
347+
348+
################################################################################
349+
# OpenTelemetry (OTEL) – disabled by default
350+
################################################################################
351+
352+
[otel]
353+
# Include user prompt text in logs. Default: false
354+
log_user_prompt = false
355+
# Environment label applied to telemetry. Default: "dev"
356+
environment = "dev"
357+
# Exporter: none (default) | otlp-http | otlp-grpc
358+
exporter = "none"
359+
360+
# Example OTLP/HTTP exporter configuration
361+
# [otel]
362+
# exporter = { otlp-http = {
363+
# endpoint = "https://otel.example.com/v1/logs",
364+
# protocol = "binary", # "binary" | "json"
365+
# headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" }
366+
# }}
367+
368+
# Example OTLP/gRPC exporter configuration
369+
# [otel]
370+
# exporter = { otlp-grpc = {
371+
# endpoint = "https://otel.example.com:4317",
372+
# headers = { "x-otlp-meta" = "abc123" }
373+
# }}
374+
```

0 commit comments

Comments
 (0)