# How to Configure no-mistakes Auto-Fix Limits Per Pipeline Step

> Configure no-mistakes auto-fix limits per pipeline step using the auto_fix map in .no-mistakes.yaml. Control correction attempts and optimize your workflow.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-07-04

---

**The `auto_fix` map in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) controls how many automatic correction attempts the agent may perform for each pipeline step, with defaults defined in [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go).**

The `no-mistakes` repository provides a configurable pipeline for automated code review and fixing. Understanding how to tune the **auto-fix limits per pipeline step** lets you balance automation against safety, preventing infinite fix loops while allowing helpful corrections. These limits are enforced at runtime by the pipeline executor and originate from repository-level configuration files.

## The AutoFix Configuration Schema

### The AutoFix Struct in config.go

In [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go), the `AutoFix` struct defines the schema for per-step limits. The `autoFixDefaults()` function establishes the baseline values, which are typically `0` for all steps unless explicitly overridden. This means auto-fix is disabled by default for every pipeline stage until you opt in via configuration.

### The AutoFixLimit Accessor

The `Config.AutoFixLimit(stepName)` method retrieves the effective limit for a specific step. When the executor queries this method, it returns either the user-defined value from the configuration file or the hard-coded default from `autoFixDefaults()`. This abstraction ensures that every step check follows a consistent fallback chain.

## Configuring Per-Step Limits in .no-mistakes.yaml

You define **auto-fix limits per pipeline step** under the top-level `auto_fix` key in your repository’s [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) file. Each key in this map corresponds to a pipeline step name (such as `review`, `lint`, `test`, `format`, `ci`, or `pr_summary`), and the value is an integer specifying the maximum number of auto-fix attempts allowed.

- Set a value to `0` to disable auto-fix entirely for that step.
- Set a positive integer to cap the number of times the agent may attempt corrections.
- Omit a step from the map to inherit the global default (currently `0`).

### Example: Enable One Auto-Fix for Lint Only

```yaml

# .no-mistakes.yaml

auto_fix:
  lint: 1
  review: 0

```

### Example: Disable All Auto-Fixes (Explicit Empty Map)

```yaml

# .no-mistakes.yaml

auto_fix: {}

```

### Example: Uniform Two-Attempt Limit Across Steps

```yaml

# .no-mistakes.yaml

auto_fix:
  review: 2
  lint: 2
  test: 2
  format: 2
  ci: 2

```

## Runtime Enforcement in the Pipeline Executor

In [`internal/pipeline/executor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/executor.go), the executor enforces these limits before invoking an agent-driven fix. The code retrieves the step-specific limit and tracks attempts against it:

```go
autoFixLimit := e.config.AutoFixLimit(stepName)
if outcome.AutoFixable && autoFixLimit > 0 && autoFixAttempts < autoFixLimit {
    // Execute auto-fix agent
}

```

This check ensures that the pipeline respects the **per-step auto-fix limits** defined in your configuration. Once the attempt counter reaches the configured limit, the executor stops auto-fixing for that step and proceeds with the remaining pipeline.

## Global CLI Overrides

For temporary adjustments without modifying the YAML file, you can use the `--auto-fix-limit` flag. This sets a global override that applies to all steps for a single run, bypassing the per-step values in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml). This is useful for debugging or emergency recovery scenarios where you want to allow exactly one fix attempt across the entire pipeline.

```bash
no-mistakes run --auto-fix-limit=3

```

## Summary

- **Configuration lives in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml)** under the `auto_fix` map, where each key is a pipeline step and each value is an integer limit.
- **Defaults are hard-coded** in [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go) within the `autoFixDefaults()` function, typically setting all limits to `0`.
- **Runtime enforcement** occurs in [`internal/pipeline/executor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/executor.go) via the `Config.AutoFixLimit(stepName)` method.
- **CLI override** via `--auto-fix-limit` provides a global temporary limit for all steps.
- **Step names** include `review`, `lint`, `test`, `format`, `ci`, and `pr_summary`.

## Frequently Asked Questions

### What is the default auto-fix limit if I don't specify anything?

According to [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go), the `autoFixDefaults()` function sets the default limit to `0` for every pipeline step. This means auto-fix is disabled by default, and you must explicitly enable it in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) to allow any automatic corrections.

### Can I disable auto-fix for specific steps while enabling it for others?

Yes. In [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml), set the specific step’s limit to `0` (or omit it to inherit the default `0`), and set positive integers only for the steps where you want auto-fix enabled. For example, setting `lint: 2` and `review: 0` allows fixes during linting but never during the review step.

### How does the CLI flag `--auto-fix-limit` interact with the YAML configuration?

The `--auto-fix-limit` flag acts as a global override that applies to all steps for the duration of that single command execution. It temporarily replaces the values read from [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) and the `autoFixDefaults()` function, allowing you to quickly adjust behavior without committing configuration changes.

### Which pipeline steps support auto-fix limits?

The `no-mistakes` pipeline supports auto-fix limits for any step defined in the configuration, including but not limited to `review`, `lint`, `test`, `format`, `ci`, and `pr_summary`. You can query the effective limit for any registered step via `Config.AutoFixLimit(stepName)` as implemented in [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go).