Agent review
When a task is in your configured in review status and tagged with agent review (the default — override via AGENT_REVIEW_TAG), aidev fetches the pull request diff via the GitHub CLI, runs an AI code review, and posts the results on the PR. This is a proactive review of the diff — it does not wait for human reviewers to leave comments.
For reactive handling of existing human review threads, see Code review resolution.
# In .env.aidev (both optional)
# AGENT_REVIEW_TAG=agent review
# AUTO_REVIEW=falsePrerequisites
- The GitHub CLI must be installed and authenticated (
gh auth login) GITHUB_REPOmust be set toowner/repoin.env.aidevso aidev can resolve the repository and PR links
Agent review uses gh to fetch the PR diff and post the review. No local checkout of the PR branch is required.
Provider support
Tagging requires a provider that supports addTag / removeTag. If your provider does not implement these, apply the tag manually in your task manager.
How it works
- At the end of every
aidev run, finds all tasks in your "in review" status that have the agent review tag - For each task, resolves the open PR by branch name (
<taskId>/<slugified-title>) viagh - Fetches the PR diff with
gh pr diff - Posts a start comment on the task — remove the agent review tag before the next run if you want to skip this review
- Runs your configured AI agent(s) with the diff and task context
- Parses the agent output as a JSON array of inline review comments
- Posts a GitHub pull request review — inline comments when issues are found, or an approving review when the array is empty
- Removes the agent review tag on success and posts a completion comment on the task
If the AI runners fail, output cannot be parsed, or gh returns an error, the tag is left in place so you can retry on the next run.
Triggering a review
Manually
Add the agent review tag to a task that is already in in review status and has an open pull request. On the next aidev run, aidev processes it.
aidev runAutomatically (AUTO_REVIEW)
When AUTO_REVIEW=true, aidev applies AGENT_REVIEW_TAG as soon as an open task is picked up for implementation. The tag stays on the task through implementation; once the task moves to in review and aidev run executes again, the automated review runs.
# In .env.aidev
AUTO_REVIEW=trueCustom review prompt
Place a skill file at .agents/skills/aidev-review/SKILL.md in your project root. When present, its contents replace the default review instructions. aidev still appends the task description, PR link, diff, and JSON output contract after your skill text.
Use this to steer the reviewer toward project-specific conventions, security policies, or areas of focus.
JSON output contract
The AI agent must respond with a JSON array. Each item is an inline review comment:
| Field | Type | Description |
|---|---|---|
path | string | File path as it appears in the PR diff |
line | number | Line number on the new file (right side of the diff) |
body | string | Review comment explaining the issue and suggested fix |
Example:
[
{
"path": "src/auth.ts",
"line": 42,
"body": "Missing null check — `user` can be undefined when the session expires."
}
]An empty array [] means the review completed with no issues. aidev posts an approving GitHub review with a summary comment instead of inline comments.
After the review
On success, aidev removes the agent review tag so the same task is not reviewed again on every run.
To merge the PR, tag the task with accepted (see Auto-merge). The typical flow is:
- Task reaches in review (implementation complete, PR open)
- Agent review runs (proactive diff review)
- Human reviewers leave comments if needed; code review resolution addresses unresolved threads on subsequent runs
- When satisfied, tag the task
acceptedto squash-merge the PR
Agent review and auto-merge are independent features — agent review does not apply the accepted tag or merge the PR.
Related
- Code review resolution — reactive fixes for unresolved human PR review threads
- Auto-merge — merge PRs for tasks tagged
accepted - Behaviour configuration —
AGENT_REVIEW_TAGandAUTO_REVIEW