concepts/customization.md +150 −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- **[Multi-agents](https://developers.openai.com/codex/concepts/multi-agents)** for delegating work to specialized sub-agents
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
57A skill is typically a `SKILL.md` file plus optional scripts, references, and assets.
58
59- my-skill/
60
61 - SKILL.md Required: instructions + metadata
62 - scripts/ Optional: executable code
63 - references/ Optional: documentation
64 - assets/ Optional: templates, resources
65
66The 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).
67
68Example `SKILL.md`:
69
70```md
71---
72name: commit
73description: Stage and commit changes in semantic groups. Use when the user wants to commit, organize commits, or clean up a branch before pushing.
74---
75
761. Do not run `git add .`. Stage files in logical groups by purpose.
772. Group into separate commits: feat → test → docs → refactor → chore.
783. Write concise commit messages that match the change scope.
794. Keep each commit focused and reviewable.
80```
81
82Use skills for:
83
84- Repeatable workflows (release steps, review routines, docs updates)
85- Team-specific expertise
86- Procedures that need examples, references, or helper scripts
87
88Skills 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.
89
90| Layer | Global | Repo |
91| :----- | :--------------------- | :--------------------------------------------- |
92| AGENTS | `~/.codex/AGENTS.md` | `AGENTS.md` in repo root or nested dirs |
93| Skills | `$HOME/.agents/skills` | `.agents/skills` in repo |
94
95Codex uses progressive disclosure for skills:
96
97- It starts with metadata (`name`, `description`) for discovery
98- It loads `SKILL.md` only when a skill is chosen
99- It reads references or runs scripts only when needed
100
101Skills can be invoked explicitly, and Codex can also choose them implicitly when the task matches the skill description. Clear skill descriptions improve triggering reliability.
102
103[Agent Skills](https://developers.openai.com/codex/skills)
104
105## MCP
106
107MCP (Model Context Protocol) is the standard way to connect Codex to external tools and context providers.
108It’s especially useful for remotely hosted systems such as Figma, Linear, Jira, GitHub, or internal knowledge services your team depends on.
109
110Use MCP when Codex needs capabilities that live outside the local repo, such as issue trackers, design tools, browsers, or shared documentation systems.
111
112A useful mental model:
113
114- **Host**: Codex
115- **Client**: the MCP connection inside Codex
116- **Server**: the external tool or context provider
117
118MCP servers can expose:
119
120- **Tools** (actions)
121- **Resources** (readable data)
122- **Prompts** (reusable prompt templates)
123
124This separation helps you reason about trust and capability boundaries. Some servers mainly provide context, while others expose powerful actions.
125
126In practice, MCP is often most useful when paired with skills:
127
128- A skill defines the workflow and names the MCP tools to use
129
130[Model Context Protocol](https://developers.openai.com/codex/mcp)
131
132## Multi-agents
133
134You 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 sub-agent stays focused and uses the right tools for its job.
135
136[Multi-agents concepts](https://developers.openai.com/codex/concepts/multi-agents)
137
138## Skills + MCP together
139
140Skills plus MCP is where it all comes together: skills define repeatable workflows, and MCP connects them to external tools and systems.
141If 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)).
142
143## Next step
144
145Build in this order:
146
1471. [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.
1482. [Skills](https://developers.openai.com/codex/skills) so you never have the same conversation twice. Skills can include a `scripts/` directory with CLI scripts or pair with [MCP](https://developers.openai.com/codex/mcp) for external systems.
1493. [MCP](https://developers.openai.com/codex/mcp) when workflows need external systems (Linear, JIRA, docs servers, design tools).
1504. [Multi-agents](https://developers.openai.com/codex/multi-agent) when you’re ready to delegate noisy or specialized tasks to sub-agents.