Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Codex Configuration and Customization

Codex Configuration and Customization

Codex offers a rich set of configuration options, letting you customize the Agent's behavior to suit different work needs.

By default, the Codex App uses the language from your system settings; if not, you can go through Settings:

select General and change the language in the General options to the one you need:

Likewise, to switch from Chinese to English, just check English:


Codex App settings

How to open: click Settings in the application menu, or press Cmd + ,:

The settings interface is shown below:

**General:** how config files are opened, and how much command output is shown in the conversation thread. You can also set multi-line prompts to require Cmd+Enter to confirm, and prevent the system from sleeping while a task is running.

**Notifications:** set when task-completion notifications are triggered, and whether the app proactively requests system notification permission.

**Agent Configuration:** the Codex Agent in the App shares the same configuration as the IDE and CLI extensions. Common options can be adjusted directly in the App; advanced options require editing the config.toml file (explained later).

**Appearance:** supports choosing a base theme, adjusting accent, background, and foreground colors, and changing the UI font and code font. Custom themes can be shared with others.

**Codex Pets:** optional animated companion characters, path:Settings > Appearance > Pets, where you can choose a built-in pet or load a custom pet from the local Codex home directory.

How to use:

The pet overlay can continuously show the current Codex working status (running / waiting for input / awaiting review) while you use other applications, along with a brief progress hint.

Custom pets (creation process):

$skill-installer hatch-pet

After installation, select from the command menu Force Reload Skills, then run:

$hatch-pet create a new pet inspired by my recent projects

Git: standardize branch naming, configure whether force push is enabled, and set the prompts Codex uses when automatically generating commit messages and PR descriptions.

**Environment:** view project directories and add projects.

Worktrees: Use Git worktrees to let Codex handle multiple tasks in parallel within the same project.

**Browser Use:** install or enable the built-in Browser plugin, and manage website whitelists and blacklists. By default, Codex asks the user before using any website; after removing a site from the blacklist, Codex resumes the asking behavior. See the in-app browser documentation for details.

** Computer Use:** macOS only. View desktop app access permissions and related preferences. To revoke system-level permissions, go to macOS Privacy & Security to change Screen Recording or Accessibility permissions.

** Archived Threads:** lists all archived conversations, showing dates and project context. Click Unarchive to restore a specific thread.


Config file locations

Layered management of Codex configuration files:

Level Path Scope
User level ~/.codex/config.toml Global default configuration
Project-level .codex/config.toml Project-specific configuration
Managed level Enterprise deployment Enterprise-wide unified configuration

Configuration merge rules

Configuration is merged by priority:


Basic configuration items

Basic configuration

~/.codex/config.toml

Default Model

model = "gpt-5.4"

Reasoning effort

model_reasoning_effort = "medium"  # minimal | low | medium | high | xhigh

Reasoning summary verbosity

model_reasoning_summary = "auto"  # auto | concise | detailed | none

Service tiers

service_tier = "flex"  # flex | fast

Approval policy

approval_policy = "suggest"  # suggest | auto-edit | full-auto


AGENTS.md

AGENTS.md is a project-level Agent instruction file that defines Codex's behavioral norms within that project.

File discovery order

  1. Read the global one ~/.codex/AGENTS.md
  2. Search each directory downward from the project root
  3. Rules in closer directories override those in farther ones

AGENTS.md example

Project AGENTS.md

Project development conventions

Tech Stack

Frontend: React + TypeScript

Backend: Python FastAPI

Database: PostgreSQL

Code Standards

Use 4-space indentation

Maximum 100 characters per line

All functions must have type annotations

Testing requirements

New features must include tests

Use pytest to run tests

Git commits

Use the Conventional Commits format

Commit messages describe "why"

Review guidelines

Don't log PII

Verify authentication middleware

Check for SQL injection

Subdirectory overrides

You can place AGENTS.override.md in a subdirectory:

Subdirectory rules

src/auth/ module rules

Security requirements

All passwords must be encrypted with bcrypt

Add audit logs

Check for SQL injection

AGENTS.md is limited to 32 KiB; anything larger is truncated.


Skills

Skills are reusable custom capabilities that encapsulate common task logic.

Skill directory locations

Position Path Purpose
REPO .agents/skills/ Project-level skills
USER ~/.agents/skills/ User-level skills
ADMIN /etc/codex/skills/ System-level skills
SYSTEM built-in Official built-in skills

Skill structure



skill-name/

├── SKILL.md       # 技能定义(必需)

├── scripts/       # 可选脚本

├── references/    # 可选参考文档

└── assets/        # 可选资源

Create a skill

Skill definition


name: code-review-standard

description: Perform standard team code review

Code review standards

Review items

Code Readability

Potential bugs

Security vulnerabilities

Performance Issues

Test coverage

Output formats

List of issues (by severity)

Improvement suggestions

Rating (1-10)

Skill triggering

Trigger Method Example
Explicit invocation $skill-name or /skill-name
Implicit matching Task description matches the skill description

Subagents (Sub-agents)

Subagents allow splitting complex tasks across multiple Agents for parallel processing.

Built-in agent types

Proxy / agent Function
default General-purpose agent
worker Execution-oriented, suitable for implementation and fixes
explorer Exploration-oriented, suitable for codebase analysis

Configure subagents

Subagent configuration

~/.codex/config.toml

[agents]

Maximum parallel threads

max_threads = 6

Maximum nesting depth

max_depth = 1

Per-task timeout

job_max_runtime_seconds = 1800

Custom agents

Custom agents

~/.codex/agents/reviewer.toml

name = "reviewer"

description = "Focus on code review and quality issues"

nickname_candidates = ["Reviewer", "QualityBot"]

developer_instructions = """

Focus on code quality review:

"""


Rules

Rules define command execution policies, controlling which commands can run automatically.

Rule files

Rules use the Starlark language (similar to Python):

Rule definition

~/.codex/rules/default.rules

Allow Git commands

prefix_rule

(

    pattern

=

[

"git"

]

,

    decision

=

"allow"

,

    justification

=

"Git commands are safe"

)

Forbid rm -rf /

prefix_rule

(

    pattern

=

[

"rm"

,

"-rf"

,

"/"

]

,

    decision

=

"forbidden"

,

    justification

=

"Prevent system damage"

)

Ask for npm commands

prefix_rule

(

    pattern

=

[

"npm"

]

,

    decision

=

"prompt"

,

    justification

=

"npm may modify dependencies"

)

Decision types

Decision Behavior
allow Auto-approve
prompt Ask for confirmation
forbidden Forbid execution

Hooks

Hooks run custom scripts on specific events.

Enable Hooks

Enable Hooks

[features]

codex_hooks = true

Hook events

Events Trigger Timing
SessionStart Session start
PreToolUse Before tool call
PostToolUse After a tool call

Configure a Hook

Hook configuration

{

  "hooks": [

    {

      "event": "PostToolUse",

      "matcher": {

        "toolName": "Bash"

      },

      "hooks": [

        {

          "type": "command",

          "command": "echo 'Command executed'",

          "timeout": 10

        }

      ]

    }

  ]

}


Common questions

Q: How do config changes take effect?

After changing the config, you need to restart Codex for it to take effect.

Q: Where should AGENTS.md be placed?

The project root, or a subdirectory that needs special rules.

Q: What is the difference between Skills and Rules?

Skills define task execution logic; Rules control command permissions.

Q: How do I view the current configuration?

Use /status command to view the current session configuration.