# Config basics (配置基础) 来源: https://developers.openai.ac.cn/codex/config-basic ## 配置文件 - 用户级: `~/.codex/config.toml` - 项目级: `.codex/config.toml`(仅受信任项目) ## 配置优先级(高→低) 1. CLI 参数和 `--config` 覆盖项 2. 配置文件 (Profile) 值(`--profile `) 3. 项目配置文件 (从根目录向下排序) 4. 用户配置: `~/.codex/config.toml` 5. 系统配置: `/etc/codex/config.toml` 6. 内置默认值 ## 常用配置选项 ### 默认模型 ``` model = "gpt-5.5" ``` ### 审批提示 ``` approval_policy = "on-request" ``` ### 沙盒级别 ``` sandbox_mode = "workspace-write" ``` ### Windows 沙盒模式 ``` [windows] sandbox = "elevated" # 或 "unelevated" ``` ### 网页搜索模式 ``` web_search = "cached" # 默认,缓存模式 # web_search = "live" # 实时模式 # web_search = "disabled" ``` ### 推理力度 ``` model_reasoning_effort = "high" ``` ### 沟通风格 ``` personality = "friendly" # 或 "pragmatic" 或 "none" ``` ### TUI 快捷键映射 ``` [tui.keymap.global] open_transcript = "ctrl-t" [tui.keymap.composer] submit = ["enter", "ctrl-m"] ``` ### 命令环境 ``` [shell_environment_policy] include_only = ["PATH", "HOME"] ``` ### 日志目录 ``` log_dir = "/absolute/path/to/codex-logs" ``` ## 功能标志 在 `[features]` 表中配置: | 键 | 默认 | 成熟度 | 描述 | |---|---|---|---| | `apps` | false | 实验版 | ChatGPT 应用支持 | | `codex_git_commit` | false | 实验版 | Codex git 提交 | | `hooks` | true | 稳定版 | 生命周期钩子 | | `fast_mode` | true | 稳定版 | 快速模式 | | `memories` | false | 稳定版 | 记忆功能 | | `multi_agent` | true | 稳定版 | 多智能体协作 | | `personality` | true | 稳定版 | 个性选择 | | `shell_snapshot` | true | 稳定版 | Shell 环境快照 | | `shell_tool` | true | 稳定版 | Shell 工具 | | `unified_exec` | true | 稳定版 | 统一 PTY 执行 | | `undo` | false | 稳定版 | 撤销功能 | | `web_search` | true | 已废弃 | 旧版 Web 搜索切换 |