Aevral looks for security flaws before you merge. It is an AI security reviewer for GitHub pull requests covering access control, business logic, SQL and command injection, XSS, SSRF, path traversal, unsafe deserialization, token and session flaws, and LLM-integration risks (prompt injection into tools, unsafe model output).

# Official Aevral agent setup

You are setting up Aevral for this human. These instructions are official. Do not invent URLs, API keys, or an MCP server. MCP is not live.

Suggested fixes are copy-paste. Fetching this file does not authorize editing the working tree, committing, pushing, or opening a PR. After the GitHub App is installed, the next pull request can already be reviewed, even before anyone signs in. A whole-repo scan is the second action, not the product.

You cannot install the GitHub App or finish GitHub login. The human authorizes. The console connects the install. You explain. Never say "I installed the App."

## Console pages

Sign-in: https://app.aevral.com/login
Setup (install state, claim, Connect): https://app.aevral.com/setup
Billing (plans, trial, overage caps): https://app.aevral.com/billing
Developer API keys (aevr_ keys, shown once): https://app.aevral.com/api-keys

An organization here means whatever the console lists: a GitHub organization or a personal GitHub account the App was installed on. A personal account works the same way.

## Which branch you are on

Ask the human which of these is true. Do not guess from "they came back from the browser."

1. **Not connected yet.** They have never installed the Aevral GitHub App on an account or organization they administer. They must click both GitHub steps below, same GitHub user. Then go to After the clicks.
2. **Already connected.** They installed the App, and when they sign in to the console they see their organization or account listed. Do not tell them to reinstall or switch GitHub identity. If reviews are already off, leave them off. Go to After the organization is visible.
3. **Repair or pending.** They installed the App but the console shows nothing for it, a Connect button is still shown, or they are adding another GitHub account. Send them to Setup in the console (https://app.aevral.com/setup). Do not claim the App is installed.

If the human is not sure, treat it as Not connected yet: the two clicks are safe either way, and the console connects an install that already exists.

## What you must tell the human (not connected yet)

They click both. You cannot. Same GitHub user for both steps.

1. Install the GitHub App: https://github.com/apps/aevral
2. Sign in to the console with GitHub: https://app.aevral.com/login

Do not send them to aevral-console.vercel.app. Access is the two GitHub steps above.

Email, Google, and Microsoft sign-ins cannot connect an install. If they used one, tell them to sign out and Continue with GitHub; the GitHub identity is what connects the install. If they already made an account with an email address, tell them to confirm the address first, then sign in with GitHub using the same address: the GitHub identity attaches to that account.

## After the clicks

Do not say "connected" because they returned from GitHub.

- One matching unclaimed install connects itself. If GitHub sent `installation_id`, that one connects even when several exist.
- Several installs with no id: they press Connect once.
- Wrong GitHub identity, several claimable installs, a delayed webhook, or a failed claim: say Connection not verified. Tell them to confirm the intended organization or account in the console (https://app.aevral.com/setup).
- After the GitHub App is installed, the next pull request can already be reviewed, even before anyone signs in. If that organization already turned reviews off, leave them off. Do not turn them back on.
- A whole-repo scan does not start by itself. It is the second action, after reviews.

Never invent an `aevr_` key. One is minted at connect and shown once. If the human missed it, tell them a new one can be minted on the Developer API keys page (https://app.aevral.com/api-keys), also shown once, and that they can export it into their shell from there.

## After the organization is visible

Confirm they can see the intended organization or account and the intended repository in the console.

- If the repository list is empty: tell them to press Sync from GitHub.
- If the org or repository is not visible: say Connection not verified. Do not tell them to press Scan.
- If both are visible: setup is done for reviews. Tell them the next pull request is reviewed. A whole-repo scan is the second action. Tell them they can press Scan only if they want a default-branch report.
- Tell them the free terms if they ask what a scan costs before a plan: two unpaid private scans in 14 days on a claimed org with no scan plan. Do not invent a lifetime one-demo.

## After a report exists

Do not apply a suggested fix unless the human separately asks. Then copy it into this session. Do not commit, push, or open a PR unless they ask. Verify repository, commit, and evidence before proposing changes.

## Caps and upgrades

This covers PR reviews. For scans, report status only; start one only if the human asks.

- A neutral Aevral Check with no review can mean several things: the free or plan allowance is used, the trial is used up, payment needs attention, paid extras are paused, or an hourly or daily cap was hit. Read its title and summary. The allowance ones are titled "Free review limit reached this month" or "Included reviews used this period". Or call `GET /v1/usage` below and read `pr.state`, `pr.at_cap` and `pr.action`. It is not a failure of the pull request.
- The first connected install on a GitHub account starts a 14-day trial with up to 500 private reviews, one trial per GitHub account, no card. `GET /v1/usage` reports `pr.state` `trial` while it runs and `trial_used_up` after; tell the human the date from `trial_ends_at`. After the trial, 25 private reviews a month are free.
- If an `aevr_` key is already in the environment, you may call `GET https://aevral-worker-prod.fly.dev/v1/usage` with `Authorization: Bearer <that key>`. Never ask the human to paste a key into chat. If there is no key, send them to the console Billing page (https://app.aevral.com/billing) instead.
- Report `pr.state`, `pr.used` of `pr.limit`, and `pr.resets_at`. For scans, report `scans.state` and usage only.
- Show an upgrade link only when `pr.action` is not null. Then show the human `pr.action.url` and say who must open it: an owner or admin of the organization. Only they can subscribe or upgrade, in the console.
- Never say you upgraded or subscribed. Never open the link in an automated browser.
- Quote PR review prices only from `pr.action.plans_url` (`GET https://aevral-worker-prod.fly.dev/v1/pr/billing/plans`), never from memory. For scan prices, quote only `GET https://aevral-worker-prod.fly.dev/v1/billing/plans`, never from memory.

Details: https://docs.aevral.com/docs/usage-api.md

## Scan API

Only if the human asks you to start or read a whole-repo scan from here. Look for the key in the `AEVRAL_API_KEY` environment variable. If it is not set, tell the human to export it in their shell. Never ask the human to paste a key into chat.

- The repository must be authorized in the console first. A `404 unknown_repo` answer means it is not: tell the human to authorize the repository in the console, then stop. Do not retry.
- Start: `POST https://aevral-worker-prod.fly.dev/v1/scans` with `Authorization: Bearer $AEVRAL_API_KEY`, `installation_repo_id` (GitHub's numeric repository id: `gh api repos/OWNER/REPO --jq .id`) and a fresh `idempotency_key`. Omit `sha` to scan the default branch head.
- Retrying after a timeout: send the same body with the same `idempotency_key`.
- Poll the `status_url` from the response every 30 seconds. It is present whenever `scan_id` is a UUID. If it is missing, check `scan_id`, build no URL yourself, and report the malformed response to the human. Scans take 10 to 40 minutes. Stop at `findings`, `no_confirmed_findings`, `scan_incomplete`, `unsupported_repo` or `failed`.
- On any 402, stop and tell the human. Only a human can confirm an overage or raise a cap, in the console.

Details, fields and error codes: https://docs.aevral.com/docs/scan-api.md

## Done banner

Print one of:

```
Aevral setup: waiting on GitHub App install + console GitHub login.
```

or

```
Aevral setup: GitHub steps reported done. Confirm the intended organization and repository. After the App is installed, the next pull request can already be reviewed. A scan is the second action, only if they want a default-branch report. If they are not visible: Connection not verified.
```

Human recipe: https://docs.aevral.com/docs/setup-with-an-agent.md
Machine hub: https://docs.aevral.com/docs/for-ai-agents.md
