# Review pull requests for exploitable bugs

This agent reads a pull request diff and posts one review comment. It
reports exploitable bugs: injection, authz bypass, secret leaks, SSRF,
RCE. Style nits stay out.

This template is one model turn: read the diff, then post one comment.

## Scaffold

```text
agent-sdk init ./security-reviewer --template security-reviewer \
  --var repos=acme/api
```

`--var repos` must name a repository already connected in Cursor for
your account. Separate multiple repositories with commas; they must
share one owner. `init` writes the list to `bot/lib/repos.ts`.

## Connect GitHub through Cursor

Connect GitHub in Cursor for those repositories (Settings or
[cursor.com/dashboard](https://cursor.com/dashboard)). Sign the host in:

```text
cd security-reviewer
agent-sdk login
```

`cursorAccount` pulls SCM events from Cursor and mints a short-lived,
repo-scoped credential. `ctx.host.github` and child `gh` commands share
it. See the [GitHub guide](/docs/guides/github.md).

## First review

```text
agent-sdk dev
```

`dev` starts the Cursor event relay for the watched repos. To drive a
known PR without waiting on a live push:

```text
agent-sdk github replay https://github.com/acme/api/pull/12 --dir .
```

`replay` needs pull access. Draft PRs and repos outside
`bot/lib/repos.ts` are ignored. The channel writes `pr/diff.patch`
after the wake is acknowledged, then starts a model turn. The model
calls `post_findings` once.

Chat replies stay in the playground. `post_findings` writes the GitHub
comment.

## What to edit

- `bot/lib/repos.ts`: watched repos
- `bot/instructions.md`: what counts as a finding and the comment
  shape
- `evals/review.eval.ts`: smoke cases

## Evals

Use the two smoke cases, one XSS fixture and one docs-only change, as a
local exercise:

```text
agent-sdk eval
```

Eval sessions skip the GitHub write.

## Deploy

```text
agent-sdk deploy
```

Run it from the agent's git checkout. The command infers repository,
ref, path, and slug. The deployment uses the team's Cursor GitHub
connection for the same watched repos.
