# Review AI-Generated Code

Use Haystack to review and QA pull requests written by coding agents — Claude Code, Codex, Cursor, Devin, or any other.

## The Problem

Coding agents produce clean-looking diffs that pass tests, at a volume no human review process can keep up with. The dangerous failure mode isn't sloppy code — it's a confident change that quietly reverses a decision, skips an edge case, or "fixes" the wrong thing. By the time QA or a customer finds it, the context is gone.

## How Haystack Solves It

- **Reads the agent transcript, not just the diff.** When a PR was written by a coding agent, Haystack analyzes the session behind it — what was asked, what the agent decided, and where the code drifted from the instructions (intent drift detection).
- **Triage with evidence**: every PR gets a rating, concrete findings, and a safe-to-merge verdict.
- **Risk-based escalation**: routine agent PRs merge through the queue; the risky ones surface in your inbox with the reasoning attached.

## Setup

```bash
npx -y @haystackeditor/cli@latest setup --repo owner/name --yes
```

To capture agent session transcripts for analysis, also install the session hooks: `npx -y @haystackeditor/cli@latest hooks install` (see [Agent Traces](/docs/agent-traces)).

## Related

- [Automated PR QA](/use-cases/automated-pr-qa) - test risky agent changes end-to-end
- [Agent setup skill](/skill.md) - let your coding agent set this up itself
