> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jacobpevans.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Running plan and diff reviews through Codex, Gemini, and local MLX

> How to fan a plan or diff out to three independent model families — the Codex CLI, the Antigravity (agy) CLI for Gemini, and a local MLX model — for adversarial review, plus the gotcha each one hits.

> Three independent model families that agree on the same finding, without seeing each other's output, is a stronger signal than any single review.

This is the working recipe for fanning a plan or diff out to **Codex**, **Gemini**, and a **local MLX model** for adversarial review — three different invocation paths, plus the one gotcha each hits, so the fan-out is repeatable instead of rediscovered every time.

## Codex — via the Codex CLI

Use the Codex MCP tool (the Codex CLI runtime), not a raw API call — it reads the repository itself instead of needing file contents pasted into the prompt.

* **Sandbox**: `read-only`; **approval-policy**: `never`; **cwd**: the repo under review.
* Point it at the plan or diff path in the prompt.

<Warning>
  **Account-pinned models**

  A Codex session backed by a ChatGPT account rejects explicit model overrides:

  ```text theme={null}
  The 'gpt-5.2' model is not supported when using Codex with a ChatGPT account.
  ```

  Other Codex-tier model names fail the same way. **Fix: omit the model
  parameter entirely** and let the session use its account default. Only pass
  an explicit model on an API-key-backed Codex session.
</Warning>

## Gemini — via the Antigravity (`agy`) CLI

The reliable CLI path for a Gemini review is Google's **Antigravity `agy` CLI**, not a raw Gemini API call.

```sh theme={null}
agy models   # list what's available
agy --model "Gemini 3.1 Pro (High)" \
  --add-dir /path/to/plan-dir \
  --add-dir /path/to/repo \
  --print-timeout 6m \
  -p 'Review ONLY (do not modify anything) the plan at <path>. ...'
```

* `-p` runs one non-interactive prompt; `--add-dir` grants read access to the
  files it must see; `--model` picks the tier.
* It is read-only without `--dangerously-skip-permissions`, so it can't
  modify anything.

<Warning>
  **Use the strong reasoner, not a flash tier**

  A flash-tier Gemini model will run, but it can hallucinate on a factual
  review — for example claiming a current tool "doesn't exist" or is
  deprecated. A stale-cutoff small model isn't reliable for this task. Use the
  strongest reasoning tier available (for example `Gemini 3.1 Pro (High)`).
</Warning>

## Local model — direct HTTP call

A locally served model that speaks the OpenAI-compatible API (see
[how the Nix stack serves a model](/local-llm/nix-serving-stack) for the
serving mechanics) needs no wrapper — call the endpoint directly with the
review prompt.

**If nothing answers on the serving port**, the local serving daemon isn't
running. Start it with your platform's service manager, then poll until the
model is loaded:

```sh theme={null}
# macOS example: launchctl kickstart -k gui/$(id -u)/<your-service-label>
curl -sf http://localhost:11434/v1/models | jq -r '.data[].id'
```

<Tip>
  **Call the local model directly**

  Use the real served model id and send the review prompt straight to the
  OpenAI-compatible endpoint:

  ```sh theme={null}
  curl -sf http://localhost:11434/v1/chat/completions \
    -H 'Content-Type: application/json' \
    -d '{"model":"mlx-community/Qwen3-30B-A3B-Instruct-2507-4bit",
         "max_tokens":1600,"temperature":0.3,
         "messages":[{"role":"system","content":"..."},
                     {"role":"user","content":"...plan..."}]}' \
    | jq -r '.choices[0].message.content'
  ```
</Tip>

<Note>
  **Ground the small model**

  A 30B-class local model — and any stale-cutoff cloud model — can confidently
  claim current tools "don't exist." Add a system line naming your current
  toolchain as real and current (for example *"Claude Code, Codex CLI, and
  Gemini CLI are all real, current tools"*) to keep the review grounded.
</Note>

## Quick reference

| Family      | Path that works                                    | Top gotcha                                                                   |
| ----------- | -------------------------------------------------- | ---------------------------------------------------------------------------- |
| Codex       | Codex MCP/CLI                                      | ChatGPT-backed sessions reject explicit model overrides — omit the parameter |
| Gemini      | Antigravity `agy` CLI, `-p` + `--add-dir`          | Flash tiers hallucinate on factual review — use the strongest reasoning tier |
| Local model | Direct HTTP call to the OpenAI-compatible endpoint | Confirm the serving daemon is up; use the real served model id               |

## Where to go next

<CardGroup cols={2}>
  <Card title="How the Nix stack serves a model" icon="server" href="/local-llm/nix-serving-stack">
    The serving stack and port behind the local endpoint used here.
  </Card>

  <Card title="Choosing a local model" icon="microchip" href="/local-llm/choosing-a-model">
    How to pick and verify a model before trusting its review output.
  </Card>

  <Card title="Writing prompts for small models" icon="message" href="/agent-ops/small-model-prompts">
    How to shape the review prompt itself once a small local model is in the loop.
  </Card>

  <Card title="AI orchestration stack" icon="route" href="/ai-development/ai-orchestration-stack">
    Where multi-model review fits among the rest of the AI tooling.
  </Card>
</CardGroup>
