> Graphify: shared context of codebase for agents and developers. Canonical: https://graphify.com/blog/codex-code-review · Full index: https://graphify.com/llms-full.txt

# How to set up Codex code review with Graphify

*November 21, 2026 · Syed Fahad*

Codex code review is OpenAI's reviewer for GitHub pull requests. You connect a repository, turn on Automatic review or comment `@codex review`, and Codex posts a normal GitHub review that flags only P0 and P1 issues. Add rules to `AGENTS.md` to steer it, and connect Graphify so every finding is checked against the rest of the codebase.

This guide covers the full setup as it works today: the GitHub settings, review rules, local reviews before you push, and how to pair Codex with [Graphify](https://app.graphify.com) so a finding about one function comes with its callers, its tests and what else it reaches. Every Codex step below was checked against OpenAI's docs on November 20, and every Graphify output is real, from a public pull request.

## What does Codex code review do?

Codex reads the pull request diff, follows the review guidance in your repository, and posts a review on the pull request like a teammate would. On GitHub it only flags P0 and P1 issues, so you get a short list of serious problems instead of a wall of style notes.

There are three ways to use it:

| Where | How you start it | What it reviews |
| --- | --- | --- |
| GitHub | `@codex review` comment, or Automatic review | The pull request diff |
| GitHub | `@codex security review` comment, or Auto security review | The diff with a security focus (research preview) |
| Your machine | `/review` in the CLI, app or IDE extension, or `codex review` | Uncommitted changes, a branch, or a commit |

GitHub review is generally available. GitLab merge request review is in preview, per OpenAI's [code review docs](https://learn.chatgpt.com/docs/code-review).

## How do you turn on Codex code review in GitHub?

You need a GitHub repository connected to Codex. To change a repository's review settings, you also need push or admin permission on it in GitHub.

### Ask for one review with @codex review

On any pull request in a connected repository, leave a comment:

```text
@codex review
```

Codex reacts with 👀 while it works, then posts its review. To point it at one area, add a focus to the same comment:

```text
@codex review for issues in the database migration
```

If nothing happens, OpenAI's troubleshooting list is short: code review is turned on for the repository, the pull request belongs to a connected repository, and the comment uses the exact trigger `@codex review`.

### Turn on automatic reviews

1. Connect the repository to Codex.
2. Open Codex settings.
3. Choose the repository and turn on **Automatic review** under **Review code**.

There is also an **Automatic review** switch under **Personal preferences**, with a **Review trigger** setting that decides which pull request events start a review. With that on, nobody has to type `@codex review` on your pull requests.

### Run a security review

Security Review is a separate, deeper pass on security risks, in research preview. Comment `@codex security review` on a pull request, or turn on **Auto security review** under **Review security vulnerabilities** in the repository settings. Set its trigger to **Whenever code review runs** to run it next to the normal review. The full report sits in the **Security Report** tab of the Codex task.

## How do you write Code Review Rules in AGENTS.md?

Codex looks for `AGENTS.md` files in your repository and follows the review rules in them. Add a section called `## Code Review Rules` and group checks under `###` headings:

```md
## Code Review Rules

### Public API
- Flag a changed signature on any exported function in src/api/ unless the
  OpenAPI spec changes in the same pull request.
  Safe path: add new parameters with defaults instead of changing old ones.

### Data access
- Flag database queries in request handlers that are not scoped to the
  caller's workspace.
```

Put rules for the whole repository in the root `AGENTS.md`, and rules for one service in a nested file next to that code, such as `services/billing/AGENTS.md`. For each changed file, Codex applies the root rules plus the more specific ones that cover it.

OpenAI's advice, from the [GitHub review guide](https://learn.chatgpt.com/docs/third-party/github), matches what we have seen work:

- Start with two or three rules that encode the comments your reviewers keep writing by hand.
- Say what the safe path or the exception is, so Codex can tell a real problem from expected behavior.
- Describe outcomes, not function names that will be renamed next quarter.
- Leave formatting and lint to CI.

Open a typical pull request, run `@codex review`, and tighten any rule that produces noise. Rules guide the review. They do not replace tests, branch protection or required approvals. If your `AGENTS.md` is already long, our post on [keeping CLAUDE.md and AGENTS.md from going stale](/blog/stale-claude-md-and-agents-md) covers what belongs there.

## How do you run a Codex review before you push?

Catching a P1 before the pull request exists is cheaper than catching it after. In the Codex CLI, app or IDE extension, type:

```text
/review
```

Pick **Review against a base branch** or **Review uncommitted changes**. The CLI also offers **Review a commit** and **Custom review instructions**. Codex reports prioritized findings and leaves your working tree alone.

From a script or a pre push hook, use the non interactive command:

```bash
codex review --base main
codex review --uncommitted
codex review --commit <sha>
```

These flags conflict with each other, so pass one per run. If you want reviews on a different model from your usual session, set `review_model` in `config.toml`.

## What does a diff only review miss?

A diff shows the lines that changed. It does not show who calls them. A two line edit to a shared helper can be correct on its own and still break a caller three folders away, and no reviewer, human or model, sees that caller unless something puts it in front of them.

That is the gap Graphify fills. Graphify is shared codebase context for coding agents and the people who work with them: a [code graph](/blog/what-is-a-code-graph), a Wiki, Memory and pull request reviews. The graph records which functions call which, which files import which, and which tests reach which code. We covered the general case in [graph based code review vs diff only review](/blog/graph-based-code-review-vs-diff-only-review). Here is how it fits with Codex.

## How do you add Graphify to Codex code review?

There are two pieces. Graphify reviews the pull request itself, next to Codex. And Codex, connected to Graphify over MCP, can ask the graph about any finding before it touches code.

### 1. Connect the repository to Graphify

Sign in at [app.graphify.com](https://app.graphify.com) and install the Graphify GitHub App on the repositories you want. Graphify indexes the default branch and rebuilds the graph on every push to it. Wait until the repository shows **Indexed**.

**PR reviews** is on by default. From then on, Graphify reviews a pull request when it is opened, reopened or marked ready for review, and drafts wait until they are ready. Each review covers the whole pull request, from where it branched to its latest commit, compared with the indexed default branch. The result shows up as a review comment from the Graphify app and a check run named **Graphify**. Reviews are advisory and never block a merge. The [reviews docs](https://docs.graphify.com/platform/reviews) cover the rest.

### 2. Connect Codex to Graphify over MCP

The quickest path is the Graphify plugin in Codex's plugin directory. If you prefer to keep setup in your own config, add the hosted MCP server from a terminal:

```bash
codex mcp add graphify --url https://api.graphify.com/mcp
codex mcp login graphify
```

Or add it to `~/.codex/config.toml`, or `.codex/config.toml` for one project:

```toml
[mcp_servers.graphify]
url = "https://api.graphify.com/mcp"
auth = "oauth"
```

Then run `codex mcp login graphify`. Sign in happens in the browser with OAuth, so there is no API key to paste. When we ran `codex mcp add` on codex-cli 0.171.0, it wrote the `[mcp_servers.graphify]` entry, detected OAuth on its own and printed the sign in link. Until you finish that sign in, `codex mcp list` shows the server as **Not logged in** and Graphify rejects the connection.

Start a new Codex session, run `/mcp` to see `graphify` listed, and test it:

```text
Use Graphify's list_repositories tool and show the repositories I can access. If the tool fails, report the error instead of guessing.
```

Use either the plugin or the manual entry, not both, or every tool shows up twice. Our [guide to adding an MCP server to Codex](/blog/how-to-add-an-mcp-server-to-codex) covers MCP in Codex more generally, and the [Graphify for Codex](https://docs.graphify.com/integrations/codex) page has troubleshooting. For how Graphify compares with other Codex plugins, see the [best Codex plugins](/blog/best-codex-plugins).

### 3. Check impact before you open the pull request

Before you run `/review`, ask Codex what the change reaches:

```text
List the functions this branch changes. For each one, use Graphify's graphify_callers, graphify_impact and graphify_tests_for tools on Graphify-Labs/graphify. Tell me which callers and tests I should look at before I push.
```

Swap in your own repository name. Now the local review and your own reading start from the callers and tests, not just the diff.

### 4. Let Codex check every finding against the graph

Once both reviews land, the loop is the same for Codex findings and Graphify findings: is this real here? Graphify's [fix review findings recipe](https://docs.graphify.com/cookbooks/fix-review-findings) puts that loop in `AGENTS.md`, next to your review rules:

```md
## Graphify review loop

Repository in Graphify: acme/web-app

When asked to handle the Graphify review on a pull request:

1. Run `gh pr checks <number> --watch` until the Graphify check finishes.
2. Run `gh pr view <number> --comments` and find the Graphify review.
3. For each finding, check it before changing code:
   - `graphify_callers` and `graphify_impact` for who depends on the code.
   - `graphify_tests_for` for the tests that cover it.
   - Read the code with `graphify_node` or open the file.
4. Fix the findings that hold up. Run the linked tests.
5. List the findings you didn't fix and why.
6. Push, then ask me before commenting `@graphify review`.
```

Then tell Codex "Handle the Graphify review on PR 123" in a session where Graphify and the GitHub CLI are both available. The same checks work on a Codex finding: paste it in and ask Codex to confirm it with the callers and tests first. Codex can also read Graphify's result directly with the `review_status` tool, which is read only and never starts a review.

## What did this look like on a real pull request?

We ran the steps above on a recent contributor pull request on the open-source Graphify repo. It teaches the Markdown extractor to turn backticked file paths into references, and it touches four files, including `graphify/extractors/markdown.py`.

Graphify's review flagged seven possible issues. They were specific, such as a test that patches `os.path.relpath` for the whole process, so a failure can come from the wrong place. The author answered the leads in a comment, fixed one real bug in a follow up commit, tidied a test and explained why the rest were by design. Graphify's review of that latest commit reported "Nothing blocking · 7 possible issues to check", and the Graphify check passed in 2 minutes 21 seconds.

From a session connected to Graphify, `review_status` returned that review as data: gate `pass`, `blocking_count` 0, `findings_total` 3, with the top findings ranked by how much code depends on each changed function. Those seven possible issues are unconfirmed leads in the review comment, and `findings_total` 3 is the graph finding count `review_status` returns for the same review:

| Changed function | File | Callers that depend on it |
| --- | --- | --- |
| `extract()` | `graphify/extract.py` | 1,305 |
| `save_cached()` | `graphify/cache.py` | 62 |
| `extract_markdown()` | `graphify/extractors/markdown.py` | 23 |

Then the follow up questions, on `extract_markdown()`:

- **`graphify_callers`** listed all 23 callers. Three are outside the tests: `graphify/extract.py`, `graphify/extractors/__init__.py`, and `_reconcile_markdown_links()` in `graphify/watch.py`. That last one is easy to miss from the diff, because watch mode is not part of the change.
- **`graphify_tests_for`** on `markdown.py` found 48 linked tests across `tests/test_languages.py`, `tests/test_markdown_sections.py` and `tests/test_markdown_code_spans.py`, plus 10 weaker matches it labels as not real links.
- **`graphify_impact`** with risk turned on ranked three hotspot files and flagged `graphify/extractors/base.py` as a hotspot with no linked tests.

Each answer also says which commit the graph was built from and how old it is, so you know what you are looking at. None of this is a verdict. It is the list of places to check, which is exactly what a P1 finding needs before anyone acts on it.

## How do Codex review and Graphify review compare?

They answer different questions, which is why running both works.

| | Codex code review | Graphify review |
| --- | --- | --- |
| Starts on | `@codex review`, or Automatic review per your Review trigger | Opened, reopened or marked ready for review |
| Rerun after a push | Depends on your Review trigger, or comment `@codex review` | Comment `@graphify review` |
| Reads | The diff and your repository guidance | The diff against the code graph of your default branch |
| Posts | A GitHub review with P0 and P1 findings | A review comment and a **Graphify** check run |
| Tune it with | `## Code Review Rules` in `AGENTS.md` | `@graphify wrong`, `@graphify good`, `@graphify suppress` |
| Across repositories | Not documented | Lists affected code in other repositories once you combine them |
| Blocks merges | Rules don't replace branch protection | No, it is advisory |

## What are the limits?

- Codex's GitHub review and Graphify's review are separate reviewers. OpenAI does not document MCP tools inside the GitHub review itself, so the graph checks in this guide run in a Codex session you start, not inside the `@codex review` comment.
- Graphify reads the indexed default branch. If the graph is behind, a finding can miss recent code. The repository page shows whether it is **Out of date**.
- After new commits, Graphify waits for `@graphify review`, and only an owner, member or collaborator can run it.
- Graph answers are evidence from the indexed files, not proof. Open the lines a finding cites before you rely on it. Where formal verification ran, its verdicts are a separate result from the review.

## Try it

Connect a repository at [app.graphify.com](https://app.graphify.com). Start with the official [Graphify plugin](https://chatgpt.com/plugins/plugin_asdk_app_6abe89f7f5d88191b9422522bb8562a4): run `/plugins` in Codex CLI, or open the **Plugins** tab in ChatGPT, install it, sign in, and start a new session. The Codex IDE extension does not support plugins yet, so there use `codex mcp add graphify --url https://api.graphify.com/mcp`, then `codex mcp login graphify`. Open a pull request and you will get Graphify's review next to Codex's.

Want the graph on your own machine instead? Open-source Graphify builds it locally:

```bash
uv tool install graphifyy
graphify install --platform codex
```

Then select the skill in Codex and enter `$graphify map the current repository`. The [Graphify skill guide](/blog/graphify-skill) walks through it.

Related reading: [AI PR review grounded in a code graph](/blog/ai-pr-review-grounded-in-a-code-graph), [change impact analysis with a code graph](/blog/change-impact-analysis-with-a-code-graph) and [how to reduce AI code review noise](/blog/reduce-ai-code-review-noise). Sources, read on November 20, 2026: OpenAI's [Review GitHub pull requests with Codex](https://learn.chatgpt.com/docs/third-party/github), [Code review](https://learn.chatgpt.com/docs/code-review), [Model Context Protocol](https://learn.chatgpt.com/docs/extend/mcp) and [developer commands](https://learn.chatgpt.com/docs/developer-commands) pages, and Graphify's [pull request reviews](https://docs.graphify.com/platform/reviews), [Graphify MCP](https://docs.graphify.com/platform/graphify-mcp), [Codex](https://docs.graphify.com/integrations/codex) and [fix review findings](https://docs.graphify.com/cookbooks/fix-review-findings) docs.

## FAQ

### How do I turn on Codex code review?

Connect your GitHub repository to Codex, open Codex settings, choose the repository and turn on Automatic review under Review code. For a single pull request, comment @codex review instead. Changing the repository settings needs push or admin permission on GitHub.

### Why does Codex only post P0 and P1 issues on GitHub?

OpenAI keeps GitHub reviews focused on high priority risks, so Codex flags only P0 and P1 issues there. Style and formatting belong in CI, and the review rules in AGENTS.md tell Codex which repository specific risks count.

### Where do Codex code review rules go?

In a section called Code Review Rules inside an AGENTS.md file. Put repository wide rules in the root AGENTS.md and service rules in a nested AGENTS.md next to that code. Codex applies the root rules plus the more specific ones that cover each changed file.

### Can I run a Codex code review before I push?

Yes. Type /review in the Codex CLI, app or IDE extension to review uncommitted changes or your branch against a base branch. From a script, run codex review --base main. The review reports findings without changing your working tree.

### Can I use Graphify and Codex code review together?

Yes. Codex reviews the diff and posts P0 and P1 findings. Graphify reviews the same pull request against the code graph of your default branch. Connect Codex to Graphify over MCP so it can check each finding with callers, impact and linked tests before it changes code.

### Does a new push start another review?

For Codex, the Review trigger setting decides which pull request events start an automatic review. For Graphify, a push does not start a new review. A repository owner, member or collaborator comments @graphify review to run one on the latest commit.
