Skip to Content

How do I have a second model review internal refactors in a Python backend before each commit?

Tares lets Claude Code build while the Codex CLI critiques the plan and reviews every commit, so internal refactors in a Python backend get a second model’s review. A blocking finding sends Claude back to fix and amend the commit. If you disagree with a finding, you waive it with /tares:challenger-waive.

How it works

You turn a Claude Code session into a challenger session. Claude plans and builds as usual, and the Codex CLI on your laptop argues with it. The review runs locally and never waits on Tares. Tares records the exchange.

  • Plan critique. When you approve the plan for your internal refactors and Claude leaves plan mode, the plugin hands the plan to Codex in a read-only sandbox. Codex looks for gaps, wrong architecture, scope, unhandled risks and missing verification. It tags each finding [P1] (the plan fails as written), [P2] (will cause rework) or [P3] (advice). A plan critique never blocks. For a [P1], Claude revises or tells you why it disagrees. Expect 30 to 90 seconds.
  • Commit review. After each git commit, the plugin has Codex review that commit.
    • No findings: Claude carries on.
    • [P1] or [P2] findings: Claude is blocked and told to fix them and fold the fix into the same commit with git commit --amend. If the reviewed commit is already on a remote, Claude makes a new commit instead. The amended commit is reviewed again as round 2, and so on until Codex is satisfied.
    • [P3] findings: context only, never blocking.
  • Limits on the loop. The loop is capped at 8 rounds per commit and 5 turn ends per session. After that, the findings come back as context. A Codex timeout, error or inconclusive review never blocks.
  • Waivers. A waived finding stays waived on later rounds, and Tares records it as a challenge_waived event.

The full walkthrough is on the challenger sessions page.

Set it up

  1. Run Tares with its MCP endpoint next to it, or use a Tares Cloud instance, which serves the endpoint itself. Locally:

    tares up tares mcp --transport streamable-http
  2. Install the Tares plugin for Claude Code. The install asks for the Tares URL, the MCP endpoint and, on a secured instance, a read + ingest API key.

    /plugin marketplace add glassflow/tares /plugin install tares@tares
  3. Install the Codex CLI and log in. Codex runs on your laptop and is billed to your OpenAI account.

    npm install -g @openai/codex codex login
  4. Start Claude Code in your Python backend repo and say “make this a challenger session”, or type /tares:challenger. Claude calls set_session_flow and the plugin marks the session.

  5. Ask for the refactor in plan mode and approve the plan. Codex critiques it, and Claude’s first reply mentions the findings.

  6. Let Claude implement and commit. Each commit is reviewed, and blocking findings send Claude back to amend.

  7. If you disagree with a blocking finding, run /tares:challenger-waive. It lists the blocking findings and waives one or all of them.

  8. Optional: set the plugin option challenger_mode to advise to make commit findings advisory. The default is strict. If Codex needs to run the project’s commands, set codex_sandbox to workspace-write or danger-full-access. The default is read-only.

What you get

  • A critique of the refactor plan before any code is written, with each finding ranked [P1], [P2] or [P3].
  • A review of every commit. Blocking findings are fixed and amended into the same commit and reviewed again before Claude moves on.
  • A way out when you disagree. Waivers are remembered for that finding and recorded on the session.
  • A record on Tares. Each plan critique, commit review and waiver is kept with the session’s transcript, so you can read back why a refactor commit was amended.
  • A predictable cost. A session with a plan and three commits is typically five to eight Codex runs, billed by OpenAI.

When something else fits

  • You want a lighter touch. Set challenger_mode to advise so commit findings inform Claude without blocking it. Plan critiques already never block.
  • You want to switch it off mid-session. /tares:challenger off turns the challenger off for the rest of that session. A session that was not marked runs no challenger.
  • You want a whole project built, not one session checked. The software factory for Claude Code runs an orchestrator, a reviewer and builders in the background, and can have a second model check every commit. Start with Build a software factory with Claude Code.
  • You do not use Codex. Set the plugin option challenger_backend to grok and give it an xAI key. Grok reasons from the patch and the changed files only, since it cannot run your tests.

Still stuck? Get help

Last updated on