OpenAI Codex | Custom Rules Bring Repository Context to Code Review
OpenAI introduced custom repository rules for Codex Code Review on July 20, 2026. Development teams can now place review guidance in AGENTS.md, helping Codex identify project-specific risks, apply instructions to the relevant files, and connect its findings with the conventions behind each warning.
Codex brings repository knowledge into pull request reviews
A code change can look correct in isolation while still breaking an older integration, exposing information that should remain private, or ignoring a convention known only by experienced contributors. These risks are difficult for a general review to detect when the necessary context does not appear in the pull request.
Custom review rules give teams a place to preserve that knowledge close to the code. Codex Code Review can select the guidance that applies to the changed files, use it while inspecting the pull request, and point the author toward the relevant rule when it reports a problem.
AGENTS.md rules can follow the structure of the repository
Teams can add a ## Code Review Rules section to an existing AGENTS.md file. Repository-wide checks belong in the file at the root, while instructions for a specific service, package, or application can be placed in a nested file closer to the code they govern.
This hierarchy prevents every pull request from carrying instructions intended for unrelated areas. A frontend application can keep component or browser compatibility rules near its source files, while another service maintains separate guidance for data handling, API contracts, or infrastructure changes.
Effective rules describe the risk and a safe alternative
OpenAI recommends beginning with two or three concise rules based on checks that reviewers repeatedly explain. Strong candidates include non-obvious compatibility requirements, data boundaries, and side effects that cannot be identified reliably through formatting tools or conventional lint rules.
A useful rule should state what behavior Codex needs to flag, why the behavior matters, and which alternative is considered safe. For web projects, this could help preserve a public component contract, protect a browser integration, or prevent a frontend change from sending sensitive information to logs. Mechanical checks should remain in CI, where they can be enforced consistently.
Representative pull requests help teams refine noisy guidance
Teams can test a new rule with a change that should trigger it, a valid counterexample, and an unrelated modification. A review can be requested through @codex review, while automatic reviews can be enabled for repositories already connected to Codex Code Review.
In OpenAI's primary evaluation suite, rule-guided configurations recovered 98% of the required custom findings, compared with 58.3% for the baseline. This result shows the potential value of focused context, but it is not a guarantee for every repository. Broad, outdated, or poorly scoped instructions can still produce unnecessary findings and should be narrowed or removed.
IMPORTANT: Custom rules guide Codex during review, but they do not provide hard enforcement. Tests, linters, branch protections, required approvals, and direct human review should remain part of the production workflow.{alertWarning}
Daisuki's Take: What This Means for Web Designers
This update gives frontend teams a practical way to preserve decisions that are easy to lose as a website grows. Component contracts, accessibility expectations, integration boundaries, and unusual browser requirements can remain close to the parts of the project where they matter.
We would keep the rules focused on issues that require repository knowledge. Turning every style preference into a review instruction may create noise, while leaving typography, formatting, and other deterministic checks to automated tools gives Codex more room to focus on consequential problems.
For agencies and template teams, the strongest benefit is consistency when contributors work in unfamiliar areas. Codex can provide an additional context-aware review pass, but responsive layouts, visual behavior, accessibility, and final production approval still need human judgment and direct testing.
Sources and Recommended Links
- Custom Code Review rules for Codex | OpenAI Developers Official Blog
- Review GitHub pull requests with Codex | OpenAI Codex Official Documentation