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

# /fix

> Dispatch fix subagent for FIX-FIRST gaps from /review, re-review, and escalate after 2 failed loops.

# /fix — Fix-Review Loop

Resolve FIX-FIRST gaps from `/review`. Dispatch a fix subagent, re-review, repeat up to 2 loops, then escalate.

## When to Use

* `/review` returned a **FIX-FIRST** verdict with CRITICAL or HIGH gaps
* Orchestrator hands off unresolved gaps after execution review

## Flow

1. **Parse gaps** — extract gap list from FIX-FIRST verdict (severity, files, failing checks).
2. **Dispatch fixer** — send gaps + original wish criteria to fix subagent.
3. **Re-review** — dispatch review subagent to validate the fix.
4. **Evaluate verdict:**

| Verdict   | Condition | Action                        |
| --------- | --------- | ----------------------------- |
| SHIP      | —         | Done. Return to orchestrator. |
| FIX-FIRST | loop \< 2 | Increment loop, go to step 2. |
| FIX-FIRST | loop = 2  | Escalate — max loops reached. |
| BLOCKED   | —         | Escalate immediately.         |

5. **Escalate (if needed)** — mark task BLOCKED, report remaining gaps.

## Escalation Format

```text theme={"dark"}
Fix loop exceeded (2/2). Escalating to human.
Remaining gaps:
- [CRITICAL] <gap description> — <file>
- [HIGH] <gap description> — <file>
```

## Dispatch

Fix and re-review are **separate dispatches** — never combined in one subagent.

```bash theme={"dark"}
# Spawn a fixer subagent
genie spawn fixer

# Spawn a reviewer subagent (separate from fixer)
genie spawn reviewer
```

## Task Lifecycle Integration

When a PG task exists for the work being fixed, each fix attempt is logged as a task comment:

| Event                    | Command                                                                        |
| ------------------------ | ------------------------------------------------------------------------------ |
| Fix attempt start        | `genie task comment #<seq> "Fix loop 1/2: [gap summary]"`                      |
| Fix attempt result       | `genie task comment #<seq> "Fix loop 1/2: [changes made]"`                     |
| Fix success              | `genie task comment #<seq> "Fix complete — [summary of all changes]"`          |
| Escalation (max loops)   | `genie task block #<seq> --reason "Fix loop exceeded (2/2)"`                   |
| Escalation (no progress) | `genie task block #<seq> --reason "No progress — identical gaps across loops"` |

Task integration is graceful — if no PG task exists, fix loop logging is skipped.

## Rules

* Never fix and review in the same session — always separate subagents
* Never exceed 2 fix loops — escalate, don't spin
* Include original wish criteria in every fix dispatch
* If identical gaps persist across loops, escalate immediately
