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

# Correction Mode

> Producer-reviewer workflow for quality assurance

Correction mode implements a producer-reviewer pattern where one model generates output and another reviews it, optionally followed by fixes based on feedback.

## Usage

### TUI (Interactive)

```bash theme={null}
/correct <producer> <reviewer> "<prompt>"
/settings        # toggle fix mode
```

### CLI

```bash theme={null}
puzldai correct "<prompt>" --producer <agent> --reviewer <agent> [--fix]
```

### Examples

```bash theme={null}
# TUI: Claude produces, Gemini reviews
/correct claude gemini "Write a REST API endpoint"

# CLI: With automatic fix
puzldai correct "Implement binary search" --producer claude --reviewer gemini --fix
```

## How It Works

**1. Production**

The producer agent generates the initial output for the task.

**2. Review**

The reviewer agent critiques the output, identifying issues, suggesting improvements, and rating quality (1-10).

**3. Fix (Optional)**

If `--fix` is enabled, the producer receives the review feedback and creates an improved version.

## Configuration

### TUI Settings

Configure fix mode via `/settings` → Collaboration tab:

| Setting | Description |
| - | - |
| Fix | Enable automatic fix after review (default: off) |

### CLI Flags

| Flag | Description |
| - | - |
| `--producer` | Agent that generates the initial output (required) |
| `--reviewer` | Agent that reviews and critiques (required) |
| `--fix` or `-f` | Enable automatic fix based on review |

## Use Cases

### Code Review

```bash theme={null}
# TUI
/correct claude codex "Implement a cache class"

# CLI
puzldai correct "Implement a cache class" --producer claude --reviewer codex --fix
```

The reviewer checks for:

* Correctness and edge cases
* Performance issues
* Code style and best practices
* Security concerns

### Writing Review

```bash theme={null}
# TUI
/correct gemini claude "Write documentation for the API"

# CLI
puzldai correct "Write documentation for the API" --producer gemini --reviewer claude
```

The reviewer evaluates:

* Clarity and completeness
* Technical accuracy
* Structure and organization

### Fact Checking

```bash theme={null}
# TUI
/correct ollama claude "Explain how SSL/TLS works"

# CLI
puzldai correct "Explain how SSL/TLS works" --producer ollama --reviewer claude
```

The reviewer verifies:

* Technical accuracy
* Completeness of explanation
* Common misconceptions

## Example Output

````
─── Correction ───

Producer: claude
━━━━━━━━━━━━━━━━
```python
def binary_search(arr, target):
    left, right = 0, len(arr)
    while left < right:
        mid = (left + right) // 2
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            left = mid + 1
        else:
            right = mid
    return -1
````

Reviewer: gemini
━━━━━━━━━━━━━━━━
**Rating: 7/10**

Issues:

1. Integer overflow possible with `(left + right) // 2` for large arrays
2. Missing input validation
3. No docstring

Suggestions:

* Use `left + (right - left) // 2` to prevent overflow
* Add type hints and docstring

Fixed Output (claude):
━━━━━━━━━━━━━━━━━━━━━━

```python theme={null}
def binary_search(arr: list, target: int) -> int:
    """Binary search for target in sorted array."""
    if not arr:
        return -1
    left, right = 0, len(arr)
    while left < right:
        mid = left + (right - left) // 2
        ...
```

## Keyboard Shortcuts

| Key | Action |
| - | - |
| `Escape` | Hide view |
| `Ctrl+E` | Return to view |
| `Ctrl+C` | Cancel |

## Tips

> [!TIP]
>
> **Use different model families** - Cross-model review catches more issues than same-model review.

> [!TIP]
>
> **Enable --fix for iterative improvement** - The producer learns from feedback and creates better output.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.