Configuration

配置参考

核对具体字段,避免凭记忆配置。

把本页作为 Codex 配置文件的可搜索参考。概念说明和示例请先从 Config basics Advanced Config 开始。

config.toml

用户级配置位于 ~/.codex/config.toml。你也可以通过 .codex/config.toml 文件添加项目级覆盖。Codex 只会在你信任该项目时加载项目级配置文件。

Project-scoped config can’t override machine-local provider, auth, host-owned app request metadata, notification, configuration profile selection, 或 telemetry routing keys。Codex ignores openai_base_url, chatgpt_base_url, apps_mcp_product_sku, model_provider, model_providers, notify, profile, profiles, experimental_realtime_ws_base_url, 和 otel 当 they appear in a project-local .codex/config.toml;put provider, notification, 和 telemetry keys in user-level config instead。Config profile files live next 到 config.toml as $CODEX_HOME/profile-name.config.toml;选择 one 使用 --profile profile-name.

For sandbox 和 approval keys (approval_policy, sandbox_mode, 和 sandbox_workspace_write.*), pair this reference 使用 Sandbox 和 approvals , Protected paths in writable roots , 和 Network access 。For beta permission profiles, see Permissions .

Key类型 / 取值说明
agents.<name>.config_filestring (path)Path 到 a TOML config layer for that role;relative paths resolve 从 the config file that declares the role.
agents.<name>.descriptionstringRole guidance shown 到 Codex 当 choosing 和 spawning that agent 输入.
agents.<name>.nickname_candidatesarray<string>Optional pool of display nicknames for spawned agents in that role.
agents.job_max_runtime_secondsnumberDefault per-worker timeout for spawn_agents_on_csv jobs。当 unset, the tool falls back 到 1800 seconds per worker.
agents.max_depthnumberMaximum nesting depth allowed for spawned agent threads (root sessions 启动 at depth 0;默认:1).
agents.max_threadsnumberMaximum number of agent threads that can be 打开 concurrently。Defaults 到 6 当 unset.
allow_login_shellbooleanAllow shell-based tools 到 使用 login-shell semantics。Defaults 到 true;当 false, login = true requests are rejected 和 omitted login 默认s 到 non-login shells.
analytics.enabledbooleanEnable 或 disable analytics for this machine/profile。当 unset, the client 默认 applies.
approval_policyuntrusted / on-request / never / { granular = { sandbox_approval = bool, rules = bool, mcp_elicitations = bool, request_permissions = bool, skill_approval = bool } }Controls 当 Codex pauses for approval 之前 executing commands。You can also 使用 approval_policy = { granular = { ..。} } 到 allow 或 auto-reject specific prompt categories while keeping other prompts interactive。on-failure is deprecated;使用 on-request for interactive runs 或 never for non-interactive runs.
approval_policy.granular.mcp_elicitationsboolean当 true, MCP elicitation prompts are allowed 到 surface 而不是 being auto-rejected.
approval_policy.granular.request_permissionsboolean当 true, prompts 从 the request_permissions tool are allowed 到 surface.
approval_policy.granular.rulesboolean当 true, approvals triggered by execpolicy prompt rules are allowed 到 surface.
approval_policy.granular.sandbox_approvalboolean当 true, sandbox escalation approval prompts are allowed 到 surface.
approval_policy.granular.skill_approvalboolean当 true, skill-script approval prompts are allowed 到 surface.
approvals_revieweruser / auto_reviewWho reviews eligible approval prompts under on-request 或 granular approval policies。Defaults 到 user;auto_review uses the reviewer subagent。This setting doesn't change sandboxing 或 检查 actions already allowed inside the sandbox.
apps._默认.approvals_revieweruser / auto_reviewDefault reviewer for app tool approval prompts unless overridden per app。当 omitted, apps inherit the top-level approvals_reviewer value.
apps._默认.默认_tools_approval_modeauto / prompt / approveDefault approval behavior for app tools 不使用 per-app 或 per-tool overrides.
apps._默认.destructive_enabledbooleanDefault allow/deny for app tools 使用 destructive_hint = true.
apps._默认.enabledbooleanDefault app enabled state for all apps unless overridden per app.
apps._默认.open_world_enabledbooleanDefault allow/deny for app tools 使用 open_world_hint = true.
apps.<id>.approvals_revieweruser / auto_reviewReviewer for this app's tool approval prompts。Overrides apps._默认.approvals_reviewer.
apps.<id>.默认_tools_approval_modeauto / prompt / approveDefault approval behavior for tools in this app unless a per-tool override exists.
apps.<id>.默认_tools_enabledbooleanDefault enabled state for tools in this app unless a per-tool override exists.
apps.<id>.destructive_enabledbooleanAllow 或 block tools in this app that advertise destructive_hint = true.
apps.<id>.enabledbooleanEnable 或 disable a specific app/connector by id (默认:true).
apps.<id>.open_world_enabledbooleanAllow 或 block tools in this app that advertise open_world_hint = true.
apps.<id>.tools.<tool>.approval_modeauto / prompt / approvePer-tool approval behavior override for a single app tool.
apps.<id>.tools.<tool>.enabledbooleanPer-tool enabled override for an app tool (例如 repos/列出).
auto_review.policystringLocal Markdown policy instructions for automatic 检查。Managed guardian_policy_config takes precedence。Blank values are ignored.
background_terminal_max_timeoutnumberMaximum poll window in milliseconds for empty write_stdin polls (background terminal polling)。Default:300000 (5 minutes)。Replaces the older background_terminal_timeout key.
chatgpt_base_urlstringOverride the base URL used during the ChatGPT login flow.
check_for_update_on_startupbooleanCheck for Codex updates on startup (设置 到 false only 当 updates are centrally managed).
cli_auth_credentials_storefile / keyring / autoControl where the CLI stores cached credentials (file-based auth.json vs OS keychain).
commit_attributionstringCommit co-author trailer used 当 [features].codex_git_commit is enabled。Defaults 到 Codex <noreply@openai.com>;设置 "" 到 disable.
compact_promptstringInline override for the history compaction prompt.
默认_permissionsstringName of the 默认 permissions profile 到 应用 到 sandboxed tool calls。Built-ins are :读取-only, :workspace, 和 :danger-full-access;custom profile names require matching [permissions.<name>] tables。Don't combine 使用 sandbox_mode 或 [sandbox_workspace_write].
developer_instructionsstringAdditional developer instructions injected into session (可选).
disable_paste_burstbooleanDisable burst-paste detection in the TUI.
experimental_compact_prompt_filestring (path)Load the compaction prompt override 从 a file (experimental).
experimental_use_unified_exec_toolbooleanLegacy name for enabling unified exec;prefer [features].unified_exec 或 codex --enable unified_exec.
features.appsbooleanEnable ChatGPT Apps/connectors support (experimental).
features.code_mode.direct_only_tool_namespacesarray<string>Tool namespaces code mode can 使用 only through direct tool calls.
features.code_mode.enabledbooleanEnable code mode feature configuration。This feature is under development 和 off by 默认.
features.code_mode.excluded_tool_namespacesarray<string>Tool namespaces code mode excludes 从 nested code-mode tool guidance 和 executor exposure.
features.codex_git_commitbooleanEnable Codex-generated git commits. When enabled, Codex uses commit_attribution 到 append a Co-authored-by:trailer 到 generated commit messages.
features.enable_request_compressionbooleanCompress streaming request bodies 使用 zstd 当 支持的 (stable;on by 默认).
features.fast_modebooleanEnable model-catalog service tier selection in the TUI, including Fast-tier commands 当 the active model advertises them (stable;on by 默认).
features.hooksbooleanEnable lifecycle hooks loaded 从 hooks.json 或 inline [hooks] config。features.codex_hooks is a deprecated alias.
features.memoriesbooleanEnable Memories (off by 默认).
features.multi_agentbooleanEnable multi-agent collaboration tools (spawn_agent, send_input, resume_agent, wait_agent, 和 close_agent) (stable;on by 默认).
features.network_proxyboolean / tableEnable sandboxed networking。使用 a table form 当 setting network policy options such as domains (experimental;off by 默认).
features.network_proxy.allow_local_bindingbooleanAllow broader local/private-network access。Defaults 到 false;exact local IP literal 或 localhost allow rules can still permit specific local targets.
features.network_proxy.allow_upstream_proxybooleanAllow chaining through an upstream proxy 从 the environment。Defaults 到 true.
features.network_proxy.dangerously_allow_all_unix_socketsbooleanPermit arbitrary Unix socket destinations 而不是 allowlist-only access。Defaults 到 false;使用 only in tightly controlled environments.
features.network_proxy.dangerously_allow_non_loopback_proxybooleanPermit non-loopback listener addresses。Defaults 到 false;enabling it can expose proxy listeners beyond localhost.
features.network_proxy.domainsmap<string, allow / deny>Domain policy for sandboxed networking。Unset by 默认, which means no external destinations are allowed until you 添加 allow rules。Supports exact hosts, *.example.com for subdomains only, **.example.com for apex plus subdomains, 和 global * allow rules;prefer scoped rules because * broadly opens public outbound access。添加 deny rules for blocked destinations;deny wins on conflicts.
features.network_proxy.enable_socks5booleanExpose SOCKS5 support。Defaults 到 true.
features.network_proxy.enable_socks5_udpbooleanAllow UDP over SOCKS5。Defaults 到 true.
features.network_proxy.enabledbooleanEnable sandboxed networking。Defaults 到 false.
features.network_proxy.proxy_urlstringHTTP listener URL for sandboxed networking。Defaults 到 "http://127.0.0.1:3128".
features.network_proxy.socks_urlstringSOCKS5 listener URL。Defaults 到 "http://127.0.0.1:8081".
features.network_proxy.unix_socketsmap<string, allow / deny>Unix socket policy for sandboxed networking。Unset by 默认;添加 allow entries for permitted sockets.
features.personalitybooleanEnable personality selection controls (stable;on by 默认).
features.prevent_idle_sleepbooleanPrevent the machine 从 sleeping while a turn is actively running (experimental;off by 默认).
features.rollout_budget.enabledbooleanEnable rollout budget tracking。This feature is under development 和 off by 默认。当 enabled, features.rollout_budget.limit_tokens is 必需.
features.rollout_budget.limit_tokensintegerPositive token limit for rollout budget tracking。Required 当 rollout budget is enabled.
features.rollout_budget.prefill_token_weightnumberFinite non-negative multiplier for prefill tokens in rollout budget accounting。Defaults 到 1.0.
features.rollout_budget.reminder_interval_tokensintegerPositive token interval between rollout budget reminders。Defaults 到 10% of limit_tokens, 使用 a minimum of 1 token.
features.rollout_budget.sampling_token_weightnumberFinite non-negative multiplier for sampled tokens in rollout budget accounting。Defaults 到 1.0.
features.shell_snapshotbooleanSnapshot shell environment 到 speed up repeated commands (stable;on by 默认).
features.shell_toolbooleanEnable the 默认 shell tool for running commands (stable;on by 默认).
features.skill_mcp_dependency_installbooleanAllow prompting 和 installing missing MCP dependencies for skills (stable;on by 默认).
features.undobooleanEnable undo support (stable;off by 默认).
features.unified_execboolean使用 the unified PTY-backed exec tool (stable;enabled by 默认 except on Windows).
features.web_searchbooleanDeprecated legacy 切换;prefer the top-level web_search setting.
features.web_search_cachedbooleanDeprecated legacy 切换。当 web_search is unset, true maps 到 web_search = "cached".
features.web_search_requestbooleanDeprecated legacy 切换。当 web_search is unset, true maps 到 web_search = "live".
feedback.enabledbooleanEnable feedback submission via /feedback across Codex surfaces (默认:true).
file_openervscode / vscode-insiders / windsurf / cursor / noneURI scheme used 到 打开 citations 从 Codex output (默认:vscode).
forced_chatgpt_workspace_idstring (uuid)Limit ChatGPT logins 到 a specific workspace identifier.
forced_login_methodchatgpt / apiRestrict Codex 到 a specific authentication method.
hide_agent_reasoningbooleanSuppress reasoning events in both the TUI 和 codex exec output.
history.max_bytesnumber如果 设置, caps the history file size in bytes by dropping oldest entries.
history.持久化encesave-all / noneControl whether Codex saves session transcripts 到 history.jsonl.
hookstableLifecycle hooks configured inline in config.toml。Uses the same event schema as hooks.json;see the Hooks guide for examples 和 支持的 events.
hooks.<Event>array<table>Matcher groups for hook events such as PreToolUse, PermissionRequest, PostToolUse, PreCompact, PostCompact, SessionStart, SubagentStart, SubagentStop, UserPromptSubmit, 或 Stop.
hooks.<Event>[].hooksarray<table>Hook handlers for a matcher group。Command hooks are currently 支持的;prompt 和 agent hook handlers are parsed but skipped.
hooks.<Event>[].hooks[].commandWindowsstringWindows-only command override for command hooks。The TOML alias command_windows is also accepted.
instructionsstringReserved for future 使用;prefer model_instructions_file 或 AGENTS.md.
log_dirstring (path)Directory where Codex writes log files;默认s 到 $CODEX_HOME/log。Setting this explicitly also enables the opt-in plaintext TUI log, codex-tui.log, in that directory.
mcp_oauth_callback_portintegerOptional fixed port for the local HTTP callback server used during MCP OAuth login。当 unset, Codex binds 到 an ephemeral port chosen by the OS.
mcp_oauth_callback_urlstringOptional base callback URL override for MCP OAuth login (例如, a devbox ingress URL)。Codex appends a server-specific callback ID 之前 sending the final OAuth redirect_uri, so register the full derived URI 使用 your provider。mcp_oauth_callback_port still controls the callback listener port.
mcp_oauth_credentials_storeauto / file / keyringPreferred store for MCP OAuth credentials.
mcp_servers.<id>.argsarray<string>Arguments passed 到 the MCP stdio server command.
mcp_servers.<id>.bearer_token_env_varstringEnvironment variable sourcing the bearer token for an MCP HTTP server.
mcp_servers.<id>.commandstringLauncher command for an MCP stdio server.
mcp_servers.<id>.cwdstringWorking directory for the MCP stdio server process.
mcp_servers.<id>.默认_tools_approval_modeauto / prompt / approveDefault approval behavior for MCP tools on this server unless a per-tool override exists.
mcp_servers.<id>.disabled_toolsarray<string>Deny 列出 applied 之后 enabled_tools for the MCP server.
mcp_servers.<id>.enabledbooleanDisable an MCP server 不使用 removing its configuration.
mcp_servers.<id>.enabled_toolsarray<string>Allow 列出 of tool names exposed by the MCP server.
mcp_servers.<id>.envmap<string,string>Environment variables forwarded 到 the MCP stdio server.
mcp_servers.<id>.env_http_headersmap<string,string>HTTP headers populated 从 environment variables for an MCP HTTP server.
mcp_servers.<id>.env_varsarray<string / { name = string, source = "local" / "remote" }>Additional environment variables 到 whitelist for an MCP stdio server。String entries 默认 到 source = "local";使用 source = "remote" only 使用 executor-backed remote stdio.
mcp_servers.<id>.experimental_environmentlocal / remoteExperimental placement for an MCP server。remote starts stdio servers through a remote executor environment;streamable HTTP remote placement is not implemented.
mcp_servers.<id>.http_headersmap<string,string>Static HTTP headers included 使用 each MCP HTTP request.
mcp_servers.<id>.oauth_resourcestringOptional RFC 8707 OAuth resource parameter 到 include during MCP login.
mcp_servers.<id>.必需boolean当 true, fail startup/恢复 如果 this enabled MCP server cannot initialize.
mcp_servers.<id>.scopesarray<string>OAuth scopes 到 request 当 authenticating 到 that MCP server.
mcp_servers.<id>.startup_timeout_msnumberAlias for startup_timeout_sec in milliseconds.
mcp_servers.<id>.startup_timeout_secnumberOverride the 默认 10s startup timeout for an MCP server.
mcp_servers.<id>.tool_timeout_secnumberOverride the 默认 60s per-tool timeout for an MCP server.
mcp_servers.<id>.tools.<tool>.approval_modeauto / prompt / approvePer-tool approval behavior override for one MCP tool on this server.
mcp_servers.<id>.urlstringEndpoint for an MCP streamable HTTP server.
memories.consolidation_modelstringOptional model override for global memory consolidation.
memories.disable_on_external_contextboolean当 true, threads that 使用 external context such as MCP tool calls, web 搜索, 或 tool 搜索 are kept out of memory generation。Defaults 到 false。Legacy alias:memories.no_memories_if_mcp_or_web_search.
memories.extract_modelstringOptional model override for per-thread memory extraction.
memories.generate_memoriesboolean当 false, newly created threads are not stored as memory-generation inputs。Defaults 到 true.
memories.max_raw_memories_for_consolidationnumberMaximum 最近 raw memories retained for global consolidation。Defaults 到 256 和 is capped at 4096.
memories.max_rollout_age_daysnumberMaximum age of threads considered for memory generation。Defaults 到 30 和 is clamped 到 0-90.
memories.max_rollouts_per_startupnumberMaximum rollout candidates processed per startup pass。Defaults 到 16 和 is capped at 128.
memories.max_unused_daysnumberMaximum days since a memory was last used 之前 it becomes ineligible for consolidation。Defaults 到 30 和 is clamped 到 0-365.
memories.min_rate_limit_remaining_percentnumberMinimum remaining percentage 必需 in Codex rate-limit windows 之前 memory generation starts。Defaults 到 25 和 is clamped 到 0-100.
memories.min_rollout_idle_hoursnumberMinimum idle time 之前 a thread is considered for memory generation。Defaults 到 6 和 is clamped 到 1-48.
memories.use_memoriesboolean当 false, Codex skips injecting 已有 memories into future sessions。Defaults 到 true.
modelstringModel 到 使用 (e.g., gpt-5.5).
model_auto_compact_token_limitnumberToken threshold that triggers automatic history compaction (unset uses model 默认s).
model_catalog_jsonstring (path)Optional path 到 a JSON model catalog loaded on startup。A selected $CODEX_HOME/profile-name.config.toml profile file can override this per profile.
model_context_windownumberContext window tokens 可用 到 the active model.
model_instructions_filestring (path)Replacement for built-in instructions 而不是 AGENTS.md.
model_providerstringProvider id 从 model_providers (默认:openai).
model_providers.<id>tableCustom provider definition。Built-in provider IDs (openai, ollama, 和 lmstudio) are reserved 和 cannot be overridden.
model_providers.<id>.authtableCommand-backed bearer token configuration for a custom provider。Do not combine 使用 env_key, experimental_bearer_token, 或 requires_openai_auth.
model_providers.<id>.auth.argsarray<string>Arguments passed 到 the token command.
model_providers.<id>.auth.commandstringCommand 到 运行 当 Codex needs a bearer token。The command must 打印 the token 到 stdout.
model_providers.<id>.auth.cwdstring (path)Working directory for the token command.
model_providers.<id>.auth.refresh_interval_msnumberHow often Codex proactively refreshes the token in milliseconds (默认:300000)。设置 到 0 到 refresh only 之后 an authentication retry.
model_providers.<id>.auth.timeout_msnumberMaximum token command runtime in milliseconds (默认:5000).
model_providers.<id>.base_urlstringAPI base URL for the model provider.
model_providers.<id>.env_http_headersmap<string,string>HTTP headers populated 从 environment variables 当 present.
model_providers.<id>.env_keystringEnvironment variable supplying the provider API key.
model_providers.<id>.env_key_instructionsstringOptional setup guidance for the provider API key.
model_providers.<id>.experimental_bearer_tokenstringDirect bearer token for the provider (discouraged;使用 env_key).
model_providers.<id>.http_headersmap<string,string>Static HTTP headers added 到 provider requests.
model_providers.<id>.namestringDisplay name for a custom model provider.
model_providers.<id>.query_paramsmap<string,string>Extra query parameters appended 到 provider requests.
model_providers.<id>.request_max_retriesnumberRetry count for HTTP requests 到 the provider (默认:4).
model_providers.<id>.requires_openai_authbooleanThe provider uses 打开AI authentication (默认s 到 false).
model_providers.<id>.stream_idle_timeout_msnumberIdle timeout for SSE streams in milliseconds (默认:300000).
model_providers.<id>.stream_max_retriesnumberRetry count for SSE streaming interruptions (默认:5).
model_providers.<id>.supports_websocketsbooleanWhether that provider supports the Responses API WebSocket transport.
model_providers.<id>.wire_apiresponsesProtocol used by the provider。responses is the only 支持的 value, 和 it is the 默认 当 omitted.
model_providers.amazon-bedrock.aws.profilestringAWS profile name used by the built-in amazon-bedrock provider.
model_providers.amazon-bedrock.aws.regionstringAWS region used by the built-in amazon-bedrock provider.
model_reasoning_effortminimal / low / medium / high / xhighAdjust reasoning effort for 支持的 models (Responses API only;xhigh is model-dependent).
model_reasoning_summaryauto / concise / detailed / none选择 reasoning summary detail 或 disable summaries entirely.
model_supports_reasoning_summariesbooleanForce Codex 到 send 或 not send reasoning metadata.
model_verbositylow / medium / highOptional GPT-5 Responses API verbosity override;当 unset, the selected model/preset 默认 is used.
notice.hide_full_access_warningbooleanTrack acknowledgement of the full access warning prompt.
notice.hide_gpt-5.1-codex-max_migration_promptbooleanTrack acknowledgement of the gpt-5.1-codex-max migration prompt.
notice.hide_gpt5_1_migration_promptbooleanTrack acknowledgement of the GPT-5.1 migration prompt.
notice.hide_rate_limit_model_nudgebooleanTrack opt-out of the rate limit model 切换 reminder.
notice.hide_world_writable_warningbooleanTrack acknowledgement of the Windows world-writable directories warning.
notice.model_migrationsmap<string,string>Track acknowledged model migrations as old->新的 mappings.
notifyarray<string>Command invoked for notifications;receives a JSON payload 从 Codex.
openai_base_urlstringBase URL override for the built-in openai model provider.
oss_providerlmstudio / ollamaDefault local provider used 当 running 使用 --oss (默认s 到 prompting 如果 unset).
otel.environmentstringEnvironment tag applied 到 emitted OpenTelemetry events (默认:dev).
otel.exporternone / otlp-http / otlp-grpc选择 the OpenTelemetry exporter 和 provide any endpoint metadata.
otel.exporter.<id>.endpointstringExporter endpoint for OTEL logs.
otel.exporter.<id>.headersmap<string,string>Static headers included 使用 OTEL exporter requests.
otel.exporter.<id>.protocolbinary / jsonProtocol used by the OTLP/HTTP exporter.
otel.exporter.<id>.tls.ca-certificatestringCA certificate path for OTEL exporter TLS.
otel.exporter.<id>.tls.client-certificatestringClient certificate path for OTEL exporter TLS.
otel.exporter.<id>.tls.client-private-keystringClient private key path for OTEL exporter TLS.
otel.log_user_promptbooleanOpt in 到 exporting raw user prompts 使用 OpenTelemetry logs.
otel.metrics_exporternone / statsig / otlp-http / otlp-grpc选择 the OpenTelemetry metrics exporter (默认s 到 statsig).
otel.trace_exporternone / otlp-http / otlp-grpc选择 the OpenTelemetry trace exporter 和 provide any endpoint metadata.
otel.trace_exporter.<id>.endpointstringTrace exporter endpoint for OTEL logs.
otel.trace_exporter.<id>.headersmap<string,string>Static headers included 使用 OTEL trace exporter requests.
otel.trace_exporter.<id>.protocolbinary / jsonProtocol used by the OTLP/HTTP trace exporter.
otel.trace_exporter.<id>.tls.ca-certificatestringCA certificate path for OTEL trace exporter TLS.
otel.trace_exporter.<id>.tls.client-certificatestringClient certificate path for OTEL trace exporter TLS.
otel.trace_exporter.<id>.tls.client-private-keystringClient private key path for OTEL trace exporter TLS.
permissions.<name>.descriptionstringHuman-readable description for this named profile。A profile does not inherit its parent's description through extends.
permissions.<name>.extendsstringOptional parent profile applied 之前 this named profile。设置 it 到 another named profile, :读取-only, 或 :workspace;:danger-full-access, undefined parents, 和 cycles are rejected.
permissions.<name>.filesystemtableNamed filesystem permission profile。Each key is an absolute path 或 special token such as :minimal 或 :workspace_roots.
permissions.<name>.filesystem.":workspace_roots".<subpath-or-glob>"读取" / "写入" / "deny"Scoped filesystem access relative 到 each effective workspace root。使用 "." for the root itself;glob subpaths such as "**/*.env" can deny reads 使用 "deny".
permissions.<name>.filesystem.<path-or-glob>"读取" / "写入" / "deny" / tableGrant direct access for a path, glob pattern, 或 special token, 或 scope nested entries under that root。使用 "deny" 到 deny reads for matching paths.
permissions.<name>.filesystem.glob_scan_max_depthnumberMaximum depth for expanding deny-read glob patterns on platforms that snapshot matches 之前 sandbox startup。Must be at least 1 当 设置.
permissions.<name>.network.allow_local_bindingbooleanPermit broader local/private-network access through sandboxed networking。Exact local IP literal 或 localhost allow rules can still permit specific local targets 当 this stays false.
permissions.<name>.network.allow_upstream_proxybooleanAllow sandboxed networking 到 chain through another upstream proxy.
permissions.<name>.network.dangerously_allow_all_unix_socketsbooleanAllow arbitrary Unix socket destinations 而不是 the 默认 restricted 设置。使用 only in tightly controlled environments.
permissions.<name>.network.dangerously_allow_non_loopback_proxybooleanPermit non-loopback bind addresses for sandboxed networking listeners。Enabling it can expose listeners beyond localhost.
permissions.<name>.network.domainstableDomain rules for sandboxed networking。Supports exact hosts, *.example.com for subdomains only, **.example.com for apex plus subdomains, 和 global * allow rules。deny wins on conflicts.
permissions.<name>.network.domains.<pattern>allow / denyAllow 或 deny an exact host 或 scoped wildcard pattern such as *.example.com 或 **.example.com.
permissions.<name>.network.enable_socks5booleanExpose SOCKS5 support 当 this permissions profile enables sandboxed networking.
permissions.<name>.network.enable_socks5_udpbooleanAllow UDP over the SOCKS5 listener 当 enabled.
permissions.<name>.network.enabledbooleanEnable network access for this named permissions profile。This changes the sandbox network policy;it does not 启动 the network proxy by itself.
permissions.<name>.network.modelimited / fullNetwork proxy mode used for subprocess traffic.
permissions.<name>.network.proxy_urlstringHTTP listener URL used 当 this permissions profile enables sandboxed networking.
permissions.<name>.network.socks_urlstringSOCKS5 proxy endpoint used by this permissions profile.
permissions.<name>.network.unix_socketstableUnix socket allowlist overrides for sandboxed networking。使用 socket paths as keys;allow adds a path, 和 deny rejects it.
permissions.<name>.network.unix_sockets.<path>allow / deny添加 an absolute Unix socket path 到 the effective allowlist 使用 allow, 或 reject it 使用 deny。Denied entries are omitted 从 the effective allowlist.
permissions.<name>.workspace_rootstableProfile-defined workspace roots that receive :workspace_roots filesystem rules alongside session's runtime workspace roots.
permissions.<name>.workspace_roots.<path>booleanOpt a path into the profile's workspace root 设置 当 true。Disabled entries remain inactive.
personalitynone / friendly / pragmaticDefault communication style for models that advertise supportsPersonality;can be overridden per thread/turn 或 via /personality.
plan_mode_reasoning_effortnone / minimal / low / medium / high / xhighPlan-mode-specific reasoning override。当 unset, Plan mode uses its built-in preset 默认.
plugins.<plugin>.mcp_servers.<server>.默认_tools_approval_modeauto / prompt / approveDefault approval behavior for tools on a plugin-provided MCP server.
plugins.<plugin>.mcp_servers.<server>.disabled_toolsarray<string>Deny 列出 applied 之后 enabled_tools for a plugin-provided MCP server.
plugins.<plugin>.mcp_servers.<server>.enabledbooleanEnable 或 disable an MCP server bundled by an installed plugin 不使用 changing the plugin manifest.
plugins.<plugin>.mcp_servers.<server>.enabled_toolsarray<string>Allow 列出 of tools exposed 从 a plugin-provided MCP server.
plugins.<plugin>.mcp_servers.<server>.tools.<tool>.approval_modeauto / prompt / approvePer-tool approval behavior override for a plugin-provided MCP tool.
project_doc_fallback_filenamesarray<string>Additional filenames 到 try 当 AGENTS.md is missing.
project_doc_max_bytesnumberMaximum bytes 读取 从 AGENTS.md 当 building project instructions.
project_root_markersarray<string>列出 of project root marker filenames;used 当 searching parent directories for the project root.
projects.<path>.trust_levelstringMark a project 或 worktree as trusted 或 untrusted ("trusted" / "untrusted")。Untrusted projects skip project-scoped .codex/ layers, including project-local config, hooks, 和 rules.
review_modelstringOptional model override used by /检查 (默认s 到 the 当前 session model).
sandbox_mode读取-only / workspace-write / danger-full-accessSandbox policy for filesystem 和 network access during command execution.
sandbox_workspace_write.exclude_slash_tmpbooleanExclude /tmp 从 writable roots in workspace-write mode.
sandbox_workspace_write.exclude_tmpdir_env_varbooleanExclude $TMPDIR 从 writable roots in workspace-write mode.
sandbox_workspace_write.network_accessbooleanAllow outbound network access inside workspace-write sandbox.
sandbox_workspace_write.writable_rootsarray<string>Additional writable roots 当 sandbox_mode = "workspace-write".
service_tierstringPreferred service tier for 新的 turns。Built-in values include flex 和 fast;legacy fast config maps 到 the request value priority, 和 catalog-provided tier IDs can also be stored.
shell_environment_policy.excludearray<string>Glob patterns for removing environment variables 之后 the 默认s.
shell_environment_policy.experimental_use_profileboolean使用 the user shell profile 当 spawning subprocesses.
shell_environment_policy.ignore_默认_excludesbooleanKeep variables containing KEY/SECRET/TOKEN 之前 other filters 运行.
shell_environment_policy.include_onlyarray<string>Whitelist of patterns;当 设置 only matching variables are kept.
shell_environment_policy.inheritall / core / noneBaseline environment inheritance 当 spawning subprocesses.
shell_environment_policy.设置map<string,string>Explicit environment overrides injected into every subprocess.
show_raw_agent_reasoningbooleanSurface raw reasoning content 当 the active model emits it.
skills.configarray<object>Per-skill enablement overrides stored in config.toml.
skills.config.<index>.enabledbooleanEnable 或 disable the referenced skill.
skills.config.<index>.pathstring (path)Path 到 a skill folder containing SKILL.md.
sqlite_homestring (path)Directory where Codex stores the SQLite-backed state DB used by agent jobs 和 other resumable runtime state.
suppress_unstable_features_warningbooleanSuppress the warning that appears 当 under-development feature flags are enabled.
tool_output_token_limitnumberToken budget for storing individual tool/function outputs in history.
tool_suggest.disabled_toolsarray<table>Disable suggestions for specific discoverable connectors 或 plugins。Each entry uses 输入 = "connector" 或 "plugin" 和 an id.
tool_suggest.discoverablesarray<table>Allow tool suggestions for additional discoverable connectors 或 plugins。Each entry uses 输入 = "connector" 或 "plugin" 和 an id.
tools.view_imagebooleanEnable the local-image attachment tool view_image.
tools.web_searchboolean / { context_size = "low / medium / high", allowed_domains = [string], location = { country, region, city, timezone } }Optional web 搜索 tool configuration。The legacy boolean form is still accepted, but the object form lets you 设置 搜索 context size, allowed domains, 和 approximate user location.
tuitableTUI-specific options such as enabling inline desktop notifications.
tui.alternate_screenauto / always / neverControl alternate screen usage for the TUI (默认:auto;auto skips it in Zellij 到 preserve scrollback).
tui.animationsbooleanEnable terminal animations (welcome screen, shimmer, spinner) (默认:true).
tui.keymap.<context>.<action>string / array<string>Keyboard shortcut binding for a TUI action。Supported contexts include global, chat, composer, editor, vim_normal, vim_operator, vim_text_object, pager, 列出, 和 approval。Selected composer actions fall back 到 matching tui.keymap.global bindings;context-specific bindings take precedence 当 支持的.
tui.keymap.<context>.<action> = []empty arrayUnbind the action in that keymap context。Key names 使用 normalized strings such as ctrl-a, shift-enter, page-down, 或 minus.
tui.model_availability_nux.<model>integerInternal startup-tooltip state keyed by model slug.
tui.notification_conditionunfocused / alwaysControl whether TUI notifications fire only 当 the terminal is unfocused 或 regardless of focus。Defaults 到 unfocused.
tui.notification_methodauto / osc9 / belNotification method for terminal notifications (默认:auto).
tui.notificationsboolean / array<string>Enable TUI notifications;可选ly restrict 到 specific event types.
tui.raw_output_modeboolean启动 the TUI in raw scrollback mode for 复制-friendly terminal selection (默认:false)。You can 切换 it 使用 /raw 或 the 默认 alt-r key binding.
tui.show_tooltipsboolean显示 onboarding tooltips in the TUI welcome screen (默认:true).
tui.status_linearray<string> / nullOrdered 列出 of TUI footer status-line item identifiers。null disables the status line.
tui.terminal_titlearray<string> / nullOrdered 列出 of terminal window/tab title item identifiers。Defaults 到 ["spinner", "project"];null disables title updates.
tui.themestringSyntax-highlighting theme override (kebab-case theme name).
tui.vim_mode_默认boolean启动 the composer in Vim normal mode 而不是 insert mode (默认:false)。You can still 切换 it per session 使用 /vim.
web_searchdisabled / cached / liveWeb 搜索 mode (默认:"cached";cached uses an 打开AI-maintained index 和 does not fetch live pages;如果 you 使用 --yolo 或 another full access sandbox setting, it 默认s 到 "live")。使用 "live" 到 fetch the most 最近 data 从 the web, 或 "disabled" 到 移除 the tool.
windows_wsl_setup_acknowledgedbooleanTrack Windows onboarding acknowledgement (Windows only).
windows.sandboxunelevated / elevatedWindows-only native sandbox mode 当 running Codex natively on Windows.
windows.sandbox_private_desktopboolean运行 the final sandboxed child process on a private desktop by 默认 on native Windows。设置 false only for compatibility 使用 the older Winsta0\\Default behavior.

你可以在这里找到最新的 config.toml JSON schema。

如果希望在 VS Code 或 Cursor 中编辑 config.toml 时获得自动补全和诊断,可以安装 Even Better TOML 扩展,并把下面这一行加到 config.toml 顶部:

#:schema https://learn.chatgpt.com/docs/config-schema.json

注意:请把 experimental_instructions_file 重命名为 model_instructions_file。Codex 已弃用旧 key;请把现有配置更新为新名称。

requirements.toml

requirements.toml 是 admin-enforced 配置文件,用来约束用户无法覆盖的安全敏感设置。详情、位置和示例请参见 Admin-enforced requirements

对于 ChatGPT Business 和 Enterprise 用户,Codex 还可以应用从 cloud 获取的 requirements。优先级详情请参见 security page。

在 requirements.toml 中使用 [features],可以用与 config.toml 相同的规范 key 固定 feature flags。省略的 key 不受约束。

Managed permission-profile allowlists 需要 Codex 0.138.0 或更高版本。Codex 0.137.0 及更早版本会忽略 allowed_permission_profiles 和 managed default_permissions。

allowed_sandbox_modes 应与 sandbox_mode 搭配使用。对于 permission-profile 部署,请将 allowed_permission_profiles 与 managed default_permissions 搭配使用。

Key类型 / 取值说明
allow_appshotsboolean设置 到 false 到 disable Appshots for managed users。如果 omitted, Appshots remain unconstrained by requirements 和 follow normal product availability.
allow_managed_hooks_onlyboolean当 true, Codex skips user, project, session, 和 plugin hooks while still allowing managed hooks 从 requirements.toml 和 other managed config layers.
allow_remote_controlboolean设置 到 false 到 disable device remote control for managed users。如果 omitted, device remote control remains unconstrained by requirements 和 follows normal product availability.
allowed_approval_policiesarray<string>Allowed values for approval_policy (例如 untrusted, on-request, never, 和 granular).
allowed_approvals_reviewersarray<string>Allowed values for approvals_reviewer, such as user 和 auto_review.
allowed_permission_profilestable<boolean>Complete 列出 of allowed permission profiles。Profiles 设置 到 true are allowed。Profiles that are omitted 或 设置 到 false are denied, including profiles added in future versions。当 requirements sources are combined, entries are matched by profile name.
allowed_permission_profiles.<name>booleanAllow 或 deny a built-in 或 custom permission profile defined in a loaded config 或 requirements source。An earlier requirements source can 使用 false 到 turn off a profile allowed by a later source.
allowed_sandbox_modesarray<string>Allowed values for sandbox_mode.
allowed_web_search_modesarray<string>Allowed values for web_search (disabled, cached, live)。disabled is always allowed;an empty 列出 effectively allows only disabled.
appstableManaged app requirements keyed by app identifier。Requirements can disable an app 或 constrain approval behavior for individual tools.
apps.<id>.enabledboolean设置 到 false 到 disable an app。A disabled requirement remains restrictive 当 multiple requirements sources are merged.
apps.<id>.tools.<tool>.approval_modeauto / prompt / approve设置 the managed approval mode for one app tool.
computer_usetableComputer 使用 requirements enforced 从 requirements.toml.
computer_use.allow_locked_computer_useboolean设置 到 false 到 prevent Computer 使用 从 operating 之后 a managed macOS device locks。如果 omitted, locked 使用 remains unconstrained by requirements.
默认_permissionsstringManaged 默认 permission profile。The profile must be allowed by allowed_permission_profiles。设置 this explicitly for predictable behavior;如果 omitted, Codex 默认s 到 :workspace only 当 both :workspace 和 :读取-only are explicitly allowed.
enforce_residencystringRequire Codex service traffic 到 使用 a 支持的 data residency。Currently accepts us.
experimental_networktableNetwork access requirements enforced 从 requirements.toml。These constraints are separate 从 features.network_proxy 和 can 配置 sandboxed networking 不使用 the user feature flag.
experimental_network.allow_local_bindingbooleanPermit broader local/private-network access for sandboxed networking。Exact local IP literal 或 localhost allow rules can still permit specific local targets 当 this stays false.
experimental_network.allow_upstream_proxybooleanAllow sandboxed networking 到 chain through an upstream proxy 从 the environment.
experimental_network.allowed_domainsarray<string>列出-shaped administrator allow rules for sandboxed networking。Do not combine this 使用 experimental_network.domains.
experimental_network.dangerously_allow_all_unix_socketsbooleanPermit arbitrary Unix socket destinations 而不是 allowlist-only access。使用 only in tightly controlled environments.
experimental_network.dangerously_allow_non_loopback_proxybooleanPermit non-loopback listener addresses for [experimental_network] requirements。Enabling it can expose listeners beyond localhost.
experimental_network.denied_domainsarray<string>列出-shaped administrator deny rules for sandboxed networking。Do not combine this 使用 experimental_network.domains.
experimental_network.domainsmap<string, allow / deny>Map-shaped administrator domain policy for sandboxed networking。Supports exact hosts, *.example.com for subdomains only, **.example.com for apex plus subdomains, 和 global * allow rules;prefer scoped rules because * broadly opens public outbound access。deny wins on conflicts。Do not combine this 使用 experimental_network.allowed_domains 或 experimental_network.denied_domains.
experimental_network.enabledbooleanEnable sandboxed networking requirements。This does not grant network access 当 the active sandbox keeps command networking off.
experimental_network.http_portintegerLoopback HTTP listener port 到 使用 for [experimental_network] requirements.
experimental_network.managed_allowed_domains_onlyboolean当 true, only administrator-managed allow rules remain effective while sandboxed networking requirements are active;user allowlist additions are ignored。Without managed allow rules, user-added domain allow rules do not remain effective.
experimental_network.socks_portintegerLoopback SOCKS5 listener port 到 使用 for [experimental_network] requirements.
experimental_network.unix_socketsmap<string, allow / deny>Administrator-managed Unix socket policy for sandboxed networking.
featurestablePinned feature values keyed by the canonical names 从 config.toml's [features] table.
features.<name>booleanRequire a specific canonical feature key 到 stay enabled 或 disabled.
features.appsbooleanPin Apps integration availability on 或 off for managed users.
features.browser_useboolean设置 到 false in requirements.toml 到 disable Browser 使用 和 Browser Agent availability.
features.browser_use_externalboolean设置 到 false in requirements.toml 到 disable external-browser Browser 使用 availability.
features.browser_use_full_cdp_accessboolean设置 到 false in requirements.toml 到 prevent users 从 enabling full Chrome DevTools Protocol access in Browser Developer mode。如果 omitted, normal product availability applies.
features.computer_useboolean设置 到 false in requirements.toml 到 disable Computer 使用, Record & Replay, 和 related 安装 或 enablement flows.
features.fast_modebooleanPin the canonical fast_mode feature on 或 off for managed users.
features.guardian_approvalbooleanPin Guardian approval availability on 或 off for managed users.
features.in_app_browserboolean设置 到 false in requirements.toml 到 disable the in-app browser pane.
features.memoriesbooleanPin Memories availability on 或 off for managed users.
features.multi_agentbooleanPin multi-agent availability on 或 off for managed users.
features.plugin_sharingboolean设置 到 false in cloud-managed requirements.toml 到 disable workspace sharing for locally built plugins.
features.pluginsbooleanPin plugin availability on 或 off for managed users.
features.workspace_dependenciesbooleanPin bundled workspace-dependency runtime availability on 或 off for managed users.
guardian_policy_configstringManaged Markdown policy instructions for automatic 检查。This takes precedence over local [auto_review].policy。Blank values are ignored.
hookstableAdmin-enforced managed lifecycle hooks。Requires a managed hook directory 和 uses the same event schema as inline [hooks] in config.toml.
hooks.<Event>array<table>Matcher groups for a hook event such as PreToolUse, PermissionRequest, PostToolUse, PreCompact, PostCompact, SessionStart, SubagentStart, SubagentStop, UserPromptSubmit, 或 Stop.
hooks.<Event>[].hooksarray<table>Hook handlers for a matcher group。Command hooks are currently 支持的;prompt 和 agent hook handlers are parsed but skipped.
hooks.<Event>[].hooks[].commandWindowsstringWindows-only command override for command hooks。The TOML alias command_windows is also accepted.
hooks.managed_dirstring (absolute path)Directory containing managed hook scripts on macOS 和 Linux。Codex validates that it is absolute 和 exists 之前 loading managed hooks.
hooks.windows_managed_dirstring (absolute path)Directory containing managed hook scripts on Windows。Codex validates that it is absolute 和 exists 之前 loading managed hooks.
mcp_serverstableAllowlist of MCP servers that may be enabled。Both the server name (<id>) 和 its identity must match for the MCP server 到 be enabled。Any configured MCP server not in the allowlist (或 使用 a mismatched identity) is disabled.
mcp_servers.<id>.identitytableIdentity rule for a single MCP server。设置 either command (stdio) 或 url (streamable HTTP).
mcp_servers.<id>.identity.commandstringAllow an MCP stdio server 当 its mcp_servers.<id>.command matches this command.
mcp_servers.<id>.identity.urlstringAllow an MCP streamable HTTP server 当 its mcp_servers.<id>.url matches this URL.
permissionstableAdmin-defined permission profiles keyed by profile name。Uses the same profile fields as config.toml.
permissions.<name>tableAdmin-defined permission profile。The name can't 启动 使用 :, 使用 the reserved name filesystem, 或 duplicate a profile 从 a loaded config。Uses the same profile fields as config.toml;see the Permissions guide for the complete profile schema.
permissions.filesystem.deny_readarray<string>Admin-enforced filesystem 读取 denials。Entries can be paths 或 glob patterns, 和 users cannot weaken them 使用 local config.
pluginstablePlugin-specific MCP server allowlists keyed by plugin identifier.
plugins.<plugin>.mcp_servers.<server>.identity.commandstringAllow a plugin's stdio MCP server 当 its configured command matches this value.
plugins.<plugin>.mcp_servers.<server>.identity.urlstringAllow a plugin's streamable HTTP MCP server 当 its configured URL matches this value.
remote_sandbox_configarray<table>Host-specific sandbox requirements。The first entry whose hostname_patterns match the resolved host name overrides top-level allowed_sandbox_modes for that requirements source。Host-specific entries currently override sandbox modes only.
remote_sandbox_config[].allowed_sandbox_modesarray<string>Allowed sandbox modes 到 应用 当 this host-specific entry matches.
remote_sandbox_config[].hostname_patternsarray<string>Case-insensitive host name patterns。Supports * for any sequence of characters 和 ? for one character.
rulestableAdmin-enforced command rules merged 使用 .rules files。Requirements rules must be restrictive.
rules.prefix_rulesarray<table>列出 of enforced prefix rules。Each rule must include pattern 和 decision.
rules.prefix_rules[].decisionprompt / forbiddenRequired。Requirements rules can only prompt 或 forbid (not allow).
rules.prefix_rules[].justificationstringOptional non-empty rationale surfaced in approval prompts 或 rejection messages.
rules.prefix_rules[].patternarray<table>Command prefix expressed as pattern tokens。Each token sets either token 或 any_of.
rules.prefix_rules[].pattern[].any_ofarray<string>A 列出 of allowed alternative tokens at this position.
rules.prefix_rules[].pattern[].tokenstringA single literal token at this position.
windowstableNative Windows sandbox requirements.
windows.allowed_sandbox_implementationsarray<string>Allowed native Windows sandbox implementations for windows.sandbox (elevated 和 unelevated)。The 列出 must not be empty。当 both are allowed 和 no mode is selected, Codex prefers elevated.

站内延伸阅读