concepts/customization.md +156 −0 added
1# Customization
2
3Customization is how you make Codex work the way your team works.
4
5In Codex, customization comes from a few layers that work together:
6
7- **Project guidance (`AGENTS.md`)** for persistent instructions
8- **Skills** for reusable workflows and domain expertise
9- **[MCP](https://developers.openai.com/codex/mcp)** for access to external tools and shared systems
10- **[Subagents](https://developers.openai.com/codex/concepts/subagents)** for delegating work to specialized subagents
11
12These are complementary, not competing. `AGENTS.md` shapes behavior, skills package repeatable processes, and [MCP](https://developers.openai.com/codex/mcp) connects Codex to systems outside the local workspace.
13
14## AGENTS Guidance
15
16`AGENTS.md` gives Codex durable project guidance that travels with your repository and applies before the agent starts work. Keep it small.
17
18Use it for the rules you want Codex to follow every time in a repo, such as:
19
20- Build and test commands
21- Review expectations
22- repo-specific conventions
23- Directory-specific instructions
24
25When the agent makes incorrect assumptions about your codebase, correct them in `AGENTS.md` and ask the agent to update `AGENTS.md` so the fix persists. Treat it as a feedback loop.
26
27**Updating `AGENTS.md`:** Start with only the instructions that matter. Codify recurring review feedback, put guidance in the closest directory where it applies, and tell the agent to update `AGENTS.md` when you correct something so future sessions inherit the fix.
28
29### When to update `AGENTS.md`
30
31- **Repeated mistakes**: If the agent makes the same mistake repeatedly, add a rule.
32- **Too much reading**: If it finds the right files but reads too many documents, add routing guidance (which directories/files to prioritize).
33- **Recurring PR feedback**: If you leave the same feedback more than once, codify it.
34- **In GitHub**: In a pull request comment, tag `@codex` with a request (for example, `@codex add this to AGENTS.md`) to delegate the update to a cloud task.
35- **Automate drift checks**: Use [automations](https://developers.openai.com/codex/app/automations) to run recurring checks (for example, daily) that look for guidance gaps and suggest what to add to `AGENTS.md`.
36
37Pair `AGENTS.md` with infrastructure that enforces those rules: pre-commit hooks, linters, and type checkers catch issues before you see them, so the system gets smarter about preventing recurring mistakes.
38
39Codex can load guidance from multiple locations: a global file in your Codex home directory (for you as a developer) and repo-specific files that teams can check in. Files closer to the working directory take precedence.
40Use the global file to shape how Codex communicates with you (for example, review style, verbosity, and defaults), and keep repo files focused on team and codebase rules.
41
42- ~/.codex/
43
44 - AGENTS.md Global (for you as a developer)
45- repo-root/
46
47 - AGENTS.md repo-specific (for your team)
48
49[Custom instructions with AGENTS.md](https://developers.openai.com/codex/guides/agents-md)
50
51## Skills
52
53Skills give Codex reusable capabilities for repeatable workflows.
54Skills are often the best fit for reusable workflows because they support richer instructions, scripts, and references while staying reusable across tasks.
55Skills are loaded and visible to the agent (at least their metadata), so Codex can discover and choose them implicitly. This keeps rich workflows available without bloating context up front.
56
57Use skill folders to author and iterate on workflows locally. If a plugin
58already exists for the workflow, install it first to reuse a proven setup. When
59you want to distribute your own workflow across teams or bundle it with app
60integrations, package it as a [plugin](https://developers.openai.com/codex/plugins/build). Skills remain the
61authoring format; plugins are the installable distribution unit.
62
63A skill is typically a `SKILL.md` file plus optional scripts, references, and assets.
64
65- my-skill/
66
67 - SKILL.md Required: instructions + metadata
68 - scripts/ Optional: executable code
69 - references/ Optional: documentation
70 - assets/ Optional: templates, resources
71
72The skill directory can include a `scripts/` folder with CLI scripts that Codex invokes as part of the workflow (for example, seed data or run validations). When the workflow needs external systems (issue trackers, design tools, docs servers), pair the skill with [MCP](https://developers.openai.com/codex/mcp).
73
74Example `SKILL.md`:
75
76```md
77---
78name: commit
79description: Stage and commit changes in semantic groups. Use when the user wants to commit, organize commits, or clean up a branch before pushing.
80---
81
821. Do not run `git add .`. Stage files in logical groups by purpose.
832. Group into separate commits: feat → test → docs → refactor → chore.
843. Write concise commit messages that match the change scope.
854. Keep each commit focused and reviewable.
86```
87
88Use skills for:
89
90- Repeatable workflows (release steps, review routines, docs updates)
91- Team-specific expertise
92- Procedures that need examples, references, or helper scripts
93
94Skills can be global (in your user directory, for you as a developer) or repo-specific (checked into `.agents/skills`, for your team). Put repo skills in `.agents/skills` when the workflow applies to that project; use your user directory for skills you want across all repos.
95
96| Layer | Global | Repo |
97| :----- | :--------------------- | :--------------------------------------------- |
98| AGENTS | `~/.codex/AGENTS.md` | `AGENTS.md` in repo root or nested directories |
99| Skills | `$HOME/.agents/skills` | `.agents/skills` in repo |
100
101Codex uses progressive disclosure for skills:
102
103- It starts with metadata (`name`, `description`) for discovery
104- It loads `SKILL.md` only when a skill is chosen
105- It reads references or runs scripts only when needed
106
107Skills can be invoked explicitly, and Codex can also choose them implicitly when the task matches the skill description. Clear skill descriptions improve triggering reliability.
108
109[Agent Skills](https://developers.openai.com/codex/skills)
110
111## MCP
112
113MCP (Model Context Protocol) is the standard way to connect Codex to external tools and context providers.
114It's especially useful for remotely hosted systems such as Figma, Linear, GitHub, or internal knowledge services your team depends on.
115
116Use MCP when Codex needs capabilities that live outside the local repo, such as issue trackers, design tools, browsers, or shared documentation systems.
117
118One way to think about it:
119
120- **Host**: Codex
121- **Client**: the MCP connection inside Codex
122- **Server**: the external tool or context provider
123
124MCP servers can expose:
125
126- **Tools** (actions)
127- **Resources** (readable data)
128- **Prompts** (reusable prompt templates)
129
130This separation helps you reason about trust and capability boundaries. Some servers mainly provide context, while others expose powerful actions.
131
132In practice, MCP is often most useful when paired with skills:
133
134- A skill defines the workflow and names the MCP tools to use
135
136[Model Context Protocol](https://developers.openai.com/codex/mcp)
137
138## Subagents
139
140You can create different agents with different roles and prompt them to use tools differently. For example, one agent might run specific testing commands and configurations, while another has MCP servers that fetch production logs for debugging. Each subagent stays focused and uses the right tools for its job.
141
142[Subagent concepts](https://developers.openai.com/codex/concepts/subagents)
143
144## Skills + MCP together
145
146Skills plus MCP is where it all comes together: skills define repeatable workflows, and MCP connects them to external tools and systems.
147If a skill depends on MCP, declare that dependency in `agents/openai.yaml` so Codex can install and wire it automatically (see [Agent Skills](https://developers.openai.com/codex/skills)).
148
149## Next step
150
151Build in this order:
152
1531. [Custom instructions with AGENTS.md](https://developers.openai.com/codex/guides/agents-md) so Codex follows your repo conventions. Add pre-commit hooks and linters to enforce those rules.
1542. Install a [plugin](https://developers.openai.com/codex/plugins) when a reusable workflow already exists. Otherwise, create a [skill](https://developers.openai.com/codex/skills) and package it as a plugin when you want to share it.
1553. [MCP](https://developers.openai.com/codex/mcp) when workflows need external systems (Linear, GitHub, docs servers, design tools).
1564. [Subagents](https://developers.openai.com/codex/subagents) when you're ready to delegate noisy or specialized tasks to subagents.