---
title: "Code Correctness"
description: "Finds logical bugs, breaking changes, and type inconsistencies in every pull request, and posts only findings Baz could prove."
canonical: "https://baz.ai/docs/agents/build/code-correctness"
---

# Code Correctness

Finds logical bugs, breaking changes, and type inconsistencies in every pull request, and posts only findings Baz could prove.

Code Correctness reviews each pull request for defects that change behavior: logic that does not do what the PR says, contracts that break consumers, and type changes that fail at runtime. It is the core Build agent. Every finding is proven before it reaches your pull request.

## What it catches

Code Correctness applies three checks independently. A defect that qualifies under more than one is reported once.

**Logical bugs** are code that does not do what the pull request or ticket says, such as a missing step, a wrong condition, or a fix applied to one function but not its siblings. **Breaking changes** are API, schema, or message changes that force an outside client to update, like a removed field or a new required one; internal refactors do not count. **Type inconsistencies** are type changes that will fail at runtime or break a database or API contract.

It also checks instruction documents that agents execute, such as `SKILL.md`, `CLAUDE.md`, and `AGENTS.md`: a cross-reference like "see Step 4" must point to the step that actually does that action.

## Why you can trust it

Every concern is independently re-checked against your code, history, team discussions, and linked ticket before it reaches your pull request. If Baz can't show how the bug is triggered on a real path, or your team already decided the behavior is intended, it doesn't post. The comments you get are few and ranked: **High** blocks the merge, **Medium** is a confirmed defect, **Low** is a defect with no clear harm yet. See [Verification protocol](/docs/concepts/verification-protocol).

## What you see

A finding is an inline review comment on the changed line:

```markdown title="PR comment"
### Retries stop after the first transient failure

`shouldRetry` loads `cfg.retry.enabled` and then returns `false`, so every
caller in `sendWithRetry` takes the no-retry path regardless of configuration.
A 503 from the payments API now fails the checkout request on the first attempt.

[Code Correctness · Severity: High] [Memory]

**Baz can fix this** - reply `apply commit` / `apply pr` to fix without changes, or comment to modify the plan.

<details>
<summary>Prompt for AI Agents</summary>
In src/payments/retry.ts around line 42, return cfg.retry.enabled ...
</details>
```

Badges under the text show the agent and severity, and when they apply: the guideline cited, a cross-repository reference, a web search, a memory, or an OWASP category. The fix options depend on **Comments fixing options** in [Configurations](/docs/admin/configurations). Reply to the comment to ask a question or push back. Your reply is used by later reviews and can become a [memory](/docs/brain/how-memory-works).

On the Build page, the row reads "Identifies bugs and breaking changes that could lead to unexpected behavior." with severity, **Scope**, memory, and the on/off switch.

## Prerequisites

None beyond connecting your VCS. Code Correctness is on by default and is never turned off automatically for low acceptance.

## Settings

Everything lives on the agent's row in **Software Factory → Build**: the on/off switch, the severity button (with **Edit** for **Manage Severity Per Repo**), **Scope** for repositories and paths, and the memory icon for **Reviewer memory**.

See [Agent settings](/docs/agents/agent-settings).

## Related

<CardGroup cols={2}>
  <Card title="Verification protocol" href="/docs/concepts/verification-protocol" icon="shield-check">
    How concerns are proven or dropped.
  </Card>
  <Card title="Fixer" href="/docs/agents/build/fixer" icon="wrench">
    Turn a finding into a commit or a PR.
  </Card>
  <Card title="Code Quality" href="/docs/agents/build/code-quality" icon="sparkles">
    Maintainability checks in the same Build stage.
  </Card>
  <Card title="Agent settings" href="/docs/agents/agent-settings" icon="settings">
    Severity, scope, and memory.
  </Card>
</CardGroup>
