Guide

The AI agent says it’s done. How do you check?

A practical way to verify work from Claude Code or Codex before you merge it: run the checks yourself, read the diff, and get a second agent to review or test against the spec.

Why “done” from an agent isn’t evidence

A coding agent stops when the work looks finished to it. Anthropic’s own Claude Code guide puts it plainly: if the agent has nothing to run that tells it whether the work is done, “looks done” is all it has to go on, and “all tests pass” on its own tells you very little. The same holds for any agent. Common ways a “done” goes wrong:

  • The tests never ran, or only one file did, or they ran against a stale build or a different environment.
  • The tests changed: an assertion was loosened, a failing case was deleted, or a test was marked skip or only.
  • The wrong thing was tested: new tests check what the code does, not what the task asked for.
  • The scope drifted: files outside the task changed, including CI config, test config or the agent’s own instruction files.

None of this needs bad intent. It happens when the same process writes the code, picks the checks and reports the result. Move the checking somewhere the agent doesn’t control.

Run the project’s own checks yourself

The one check that settles it is your test suite running on the agent’s branch, started by you or by CI, with the output in front of you. Use the same commands your team uses, not ones the agent picked for this task.

git fetch origin
git switch agent/task-42
npm ci
npm test
npm run lint
npm run build
  • Install dependencies fresh, so you aren’t testing against leftovers from the agent’s session.
  • Run the full suite, not only the tests the agent mentions.
  • When you do ask the agent to check its own work, ask for evidence: the exact command it ran and its output.
  • In Claude Code you can also enforce a check: a Stop hook runs your script whenever Claude tries to end its turn and sends it back to work if the script exits with code 2.

Read the diff, starting with the tests

Before reading the implementation, look at what changed and where. Compare the file list with what the task allowed.

git diff --stat main...agent/task-42
git diff --name-only main...agent/task-42
git diff main...agent/task-42 -- '*test*' '*spec*'
If the diff touchesCheck that
Existing test filesNo assertions were weakened or removed and no tests were skipped, unless the task asked for it
Test or build configTest paths, coverage thresholds and lint rules weren’t loosened
CI workflowsNo step was removed or made to always pass
Agent instruction files such as CLAUDE.md or AGENTS.mdThe change is one you actually want every future session to follow
Files outside the taskEach one has a reason you agree with

A quick search for newly skipped tests helps, for example git diff main...agent/task-42 | grep -nE '^\+.*(\.skip\(|\.only\(|pytest\.mark\.skip)'. Adjust the pattern to your test framework.

Keep each task on its own branch or worktree

One task per branch makes every check above simple: the diff is only that task, and you can rerun its tests without anything else mixed in. A git worktree is a separate checkout on its own branch, so two agents can work at once without editing the same folder.

git worktree add -b agent/task-42 ../myapp-task-42 main
cd ../myapp-task-42
# run the agent here, then your checks
git worktree remove ../myapp-task-42

Claude Code has this built in: claude --worktree task-42 starts an isolated session on its own worktree. The repository needs at least one commit first.

How to have a second AI review or test the code

A second agent helps only if it isn’t simply agreeing with the first. Set it up so it can’t.

  1. Give it the spec, not the first agent’s reasoningHand over the task description or spec file and the diff. Leave out the first agent’s summary, so the reviewer judges the result, not the story about it.
  2. Ask it to check against the specFor example: “Review the diff between main and this branch against SPEC.md. Check every requirement is implemented and each listed edge case has a test. Report only gaps that affect correctness; skip style. Don’t edit files.” Asking it to skip style matters: a reviewer told to find problems will always find something.
  3. Or ask it to write testsLet it add tests from the spec, limited to test files, then run your commands yourself. Afterwards, check with git diff --name-only that it touched only test files, and don’t let the original agent edit the tests it added.
  4. Use a model from another vendorHave Codex review Claude Code’s branch, or the other way round. A different model doesn’t start from the same assumptions, so you get a more independent view. It can still be wrong.
  5. Don’t let the reviewer fix things silentlyFindings go back to the agent that wrote the code, and the checks run again. A reviewer that edits the code becomes a second author, and nobody reviewed its edits.

Both vendors ship a review command. Each one is an AI review, not a test run.

ToolCommandWhat it does
Claude Code/code-review (alias /review)Reviews your branch’s changes, or a PR, branch, path or range you pass, for correctness bugs, in a subagent that never saw your conversation. Report only, unless you add --fix.
Claude Code/security-reviewChecks the diff between your branch and origin’s default branch for security issues.
Codex CLI/reviewReviews uncommitted changes, a commit or a base branch, or follows custom instructions, and reports prioritized findings without modifying your working tree.
Codex CLIcodex review --base mainThe same review, non-interactive, against a base branch. --uncommitted, --commit and custom instructions are alternatives.
# Codex reviews a branch Claude Code wrote
git switch agent/task-42
codex review --base main

# Claude Code reviews a branch Codex wrote, without editing
claude -p "/code-review main...agent/task-43"

Reviews use your plan’s usage or API billing like any other session. A review that finds nothing doesn’t replace running the tests.

A checklist to copy

- [ ] The task ran on its own branch or worktree
- [ ] I ran install, test, lint and build on that branch myself (or CI did)
- [ ] I read the output, not the agent's summary
- [ ] The changed files match what the task allowed
- [ ] No existing test was weakened, deleted or skipped without a reason
- [ ] No changes to CI, test config or agent instruction files I didn't ask for
- [ ] A second agent (another vendor if possible) reviewed it against the spec
- [ ] The reviewer reported; the author fixed; the checks ran again
- [ ] I decided to merge

Where Pyloxa fits

Pyloxa is a free Windows app that runs Claude Code and Codex CLI together on one project, and it does most of the checklist above for you. An agent saying it’s done never counts. When a task finishes, Pyloxa runs the verification commands you approved (tests, build, lint) in that task’s own worktree and checks that the changed files are within the plan’s write scope. A result is accepted automatically only when at least one check exists, everything passes and no human review is required. If a check fails, the same agent is asked to fix it, with at most three automatic runs per task.

  • Cross-testing: a different agent, for example Codex on Claude Code’s work, adds tests and Pyloxa reruns your commands; the command result decides. The tester can only change test files, and the original agent can’t change the tests it added. In the free version you choose “Have another agent test it”; Pro does it automatically by your settings, with failed tests sent back for a fix.
  • Brain review (free): the brain reads finished work without changing it, and its verdict is labelled as an AI judgment. It never reviews its own task.
  • Changes to .github, CLAUDE.md, AGENTS.md, .mcp.json or the files that define your check commands are never accepted automatically. Merging, pushing and opening a PR always wait for you.
  • The verification card (free) goes on your PR: who did each result, who cross-tested it, which commands Pyloxa ran and how it was accepted. Its optional closing line says “Verified with Pyloxa” only if every result passed the commands Pyloxa ran and every gate passed, and “Verification record by Pyloxa” otherwise.

You don’t need it for one agent on small changes you review yourself, or if CI already runs on every agent branch and you read the diffs. The setup wizard’s free test drive shows the whole process on a sample project with a hidden bug. Details: Workflow: checks and Help: checks, brain review and cross-testing.

FAQ

Why does the agent say tests pass when they fail for me?
Usually it ran a subset, ran them before a later edit, used a different environment, or reported from memory. Ask for the exact command and output, then rerun the full suite yourself on a clean install.
Should the same agent review its own code?
It helps less than a fresh reviewer. Claude Code’s /code-review runs in a subagent that never saw your conversation, which is better; a model from another vendor working from the spec is more independent still. Either way, the test results decide, not the review.
Can I let the reviewer fix what it finds?
You can, but then its edits need checking too. Codex’s /review reports without modifying your working tree, and Claude Code’s /code-review only edits with --fix. Keeping fixes with the original author and rerunning the checks is easier to follow.
How do I stop an agent from editing tests to make them pass?
Say so in the task, then enforce it. Review the diff of test files on every branch, and in Claude Code a PreToolUse hook can block edits to paths you choose. Having a separate agent write the tests also helps.
Is an AI code review enough to merge?
No. It catches things tests miss, but it’s a judgment. Merge on passing commands you ran, a diff you read, and your own review of risky areas such as auth, payments and migrations.

Sources

  1. Best practices for Claude Code, Anthropic (checked 2026-11-19)
  2. Review locally with /code-review, Anthropic (checked 2026-11-19)
  3. Commands, Anthropic (checked 2026-11-19)
  4. Common workflows: run parallel sessions with worktrees, Anthropic (checked 2026-11-19)
  5. Codex CLI, OpenAI (checked 2026-11-19)
  6. Developer commands: codex review, OpenAI (checked 2026-11-19)
  7. git-worktree, Git documentation (checked 2026-11-19)

Want this handled for you?

Pyloxa is a free Windows app that runs the Claude Code and Codex CLIs you already use: it splits the work by your rules, runs your tests itself and offers a handoff when one runs out of quota.