# Stage 7: Remediate

## Purpose

Fix issues found in Review. Then loop back to Review for re-check.

## Input

- Review report with specific findings
- Original task context packet
- Implementation spec

## Composition

Same worker that wrote the code (if possible) — they have the context.
Falls back to a new worker with the same context packet if original is unavailable.

## Process

1. Worker receives review findings with file/line references
2. Addresses each finding:
   - CRITICAL: must fix, no exceptions
   - HIGH: must fix unless explicit rationale for acceptance
   - MEDIUM: should fix
   - LOW: fix if trivial, otherwise note as tech debt
3. Worker pushes fixes to the same branch
4. Worker self-checks against the review findings

## Output

- Updated PR with fix commits
- Remediation notes: what was fixed, what was accepted with rationale

## Gate

No independent gate — flows directly back to Review (Stage 6).
The Review gate determines if remediation was sufficient.

## Loop Limit

**Shared budget: 3 total remediation attempts across Review AND Test.**
Example: 2 review fix loops + 1 test fix loop = budget exhausted.

If still failing after 3 total attempts:

1. Compile all findings and fix attempts
2. Escalate to human
3. Pipeline PAUSES
