PR Deep Review Agent
Purpose
Launch one fresh subagent that reviews the current PR independently. The subagent must inspect code, tests, local docs, and official/current internet documentation for the technologies touched by the PR, then return a complete approval report.
Workflow
- Identify PR context locally:
- Current working directory.
- Current branch and HEAD SHA.
- Base branch and PR number, using
gh pr view --json number,baseRefName,headRefName,url,title when available.
- Changed files, using
git diff --name-only origin/<base>...HEAD or the closest available base.
- Launch exactly one clean-context subagent with
spawn_agent.
- Use
agent_type: "explorer" for read-only review.
- Set
fork_context: false unless the user explicitly asks to pass current conversation context.
- Do not ask the subagent to modify files.
- While the subagent runs, optionally gather non-overlapping local context only if useful. Do not duplicate the whole review.
- Wait for the subagent when its result is needed for the user-facing answer.
- Relay the report clearly, preserving verdict and severity.
Subagent Prompt Template
Use this prompt, filling brackets with discovered values:
You are a clean-context PR review agent. Do not modify files.
Repository: [absolute repo path]
PR: [PR number and URL if known]
Branch: [current branch]
HEAD: [HEAD SHA]
Base: [base branch]
Task:
Perform a deep review of this PR and decide whether it is APPROVED or CHANGES REQUESTED.
Required review scope:
1. Analyze the PR diff and the surrounding implementation code.
2. Analyze relevant tests and identify meaningful test gaps.
3. Read relevant local documentation in the repository and compare it to the implementation.
4. Research official/current internet documentation for external technologies or APIs used by the changed code. Prefer primary sources: official docs, official API references, standards, or upstream repos. Include source links in the report.
5. Identify mismatches between implementation, local docs, and official docs.
6. Identify security, data integrity, race condition, compatibility, and regression risks.
7. Identify what should NOT be changed or added if a requested/reviewed change would be unnecessary, risky, or out of scope.
Constraints:
- Read-only review only. Do not edit files, commit, push, or comment on GitHub.
- Do not rely only on prior conversation context. Rebuild facts from repo, PR metadata, local docs, and official docs.
- If internet access or GitHub access is unavailable, say exactly what could not be verified and lower confidence accordingly.
- Treat local tests passing as useful but not sufficient for approval.
Report format:
# PR Deep Review Report
## Verdict
APPROVED or CHANGES REQUESTED
## Confidence
High / Medium / Low, with one sentence why.
## Sources Checked
- Local files/docs inspected.
- Official internet docs inspected, with links.
## Findings
Group findings by severity:
- Blocking
- Should-fix
- Minor / Nits
- Test gaps
For each finding include: title, affected files/lines when possible, why it matters, evidence, and recommended action.
## Documentation Gaps
List mismatches between local docs and implementation or official docs.
## What Not To Do
List changes that should be avoided because they are unsafe, unnecessary, or out of scope.
## Validation Notes
Mention commands or checks run, if any, and their results.
## Final Recommendation
One concise paragraph stating whether the PR can merge or what must happen first.
Review Standards
- Prefer correctness over politeness. Report real blockers even when CI passes.
- Separate verified facts from assumptions.
- Use severity strictly:
- Blocking: merge would likely break production, create a security/access-control issue, corrupt data, or violate official API behavior.
- Should-fix: important risk or maintainability issue that should be resolved before merge unless explicitly accepted.
- Minor / Nits: low-risk polish, clarity, or cleanup.
- Test gaps: missing coverage that matters; do not call every uncovered branch a gap.
- If no actionable issues are found, return
APPROVED and still list sources checked and residual risks.
Parent Agent Response
After the subagent returns:
- Summarize verdict first.
- List blocking/should-fix items, if any.
- Say whether the PR is approved.
- If the subagent found issues, ask or proceed according to the user's latest instruction; do not silently change files unless the user asked to correct them.
1---2name: pr-deep-review-agent3description: Launch a clean-context subagent to perform a deep pull request review. Use when the user asks to launch/run/spawn another agent for PR review, final approval review, clean-context code review, or a review that compares code against local documentation and official internet documentation before reporting whether the PR is approved or changes are required.4---56# PR Deep Review Agent78## Purpose910Launch one fresh subagent that reviews the current PR independently. The subagent must inspect code, tests, local docs, and official/current internet documentation for the technologies touched by the PR, then return a complete approval report.1112## Workflow13141. Identify PR context locally:15 - Current working directory.16 - Current branch and HEAD SHA.17 - Base branch and PR number, using `gh pr view --json number,baseRefName,headRefName,url,title` when available.18 - Changed files, using `git diff --name-only origin/<base>...HEAD` or the closest available base.192. Launch exactly one clean-context subagent with `spawn_agent`.20 - Use `agent_type: "explorer"` for read-only review.21 - Set `fork_context: false` unless the user explicitly asks to pass current conversation context.22 - Do not ask the subagent to modify files.233. While the subagent runs, optionally gather non-overlapping local context only if useful. Do not duplicate the whole review.244. Wait for the subagent when its result is needed for the user-facing answer.255. Relay the report clearly, preserving verdict and severity.2627## Subagent Prompt Template2829Use this prompt, filling brackets with discovered values:3031```text32You are a clean-context PR review agent. Do not modify files.3334Repository: [absolute repo path]35PR: [PR number and URL if known]36Branch: [current branch]37HEAD: [HEAD SHA]38Base: [base branch]3940Task:41Perform a deep review of this PR and decide whether it is APPROVED or CHANGES REQUESTED.4243Required review scope:441. Analyze the PR diff and the surrounding implementation code.452. Analyze relevant tests and identify meaningful test gaps.463. Read relevant local documentation in the repository and compare it to the implementation.474. Research official/current internet documentation for external technologies or APIs used by the changed code. Prefer primary sources: official docs, official API references, standards, or upstream repos. Include source links in the report.485. Identify mismatches between implementation, local docs, and official docs.496. Identify security, data integrity, race condition, compatibility, and regression risks.507. Identify what should NOT be changed or added if a requested/reviewed change would be unnecessary, risky, or out of scope.5152Constraints:53- Read-only review only. Do not edit files, commit, push, or comment on GitHub.54- Do not rely only on prior conversation context. Rebuild facts from repo, PR metadata, local docs, and official docs.55- If internet access or GitHub access is unavailable, say exactly what could not be verified and lower confidence accordingly.56- Treat local tests passing as useful but not sufficient for approval.5758Report format:59# PR Deep Review Report6061## Verdict62APPROVED or CHANGES REQUESTED6364## Confidence65High / Medium / Low, with one sentence why.6667## Sources Checked68- Local files/docs inspected.69- Official internet docs inspected, with links.7071## Findings72Group findings by severity:73- Blocking74- Should-fix75- Minor / Nits76- Test gaps77For each finding include: title, affected files/lines when possible, why it matters, evidence, and recommended action.7879## Documentation Gaps80List mismatches between local docs and implementation or official docs.8182## What Not To Do83List changes that should be avoided because they are unsafe, unnecessary, or out of scope.8485## Validation Notes86Mention commands or checks run, if any, and their results.8788## Final Recommendation89One concise paragraph stating whether the PR can merge or what must happen first.90```9192## Review Standards9394- Prefer correctness over politeness. Report real blockers even when CI passes.95- Separate verified facts from assumptions.96- Use severity strictly:97 - **Blocking**: merge would likely break production, create a security/access-control issue, corrupt data, or violate official API behavior.98 - **Should-fix**: important risk or maintainability issue that should be resolved before merge unless explicitly accepted.99 - **Minor / Nits**: low-risk polish, clarity, or cleanup.100 - **Test gaps**: missing coverage that matters; do not call every uncovered branch a gap.101- If no actionable issues are found, return `APPROVED` and still list sources checked and residual risks.102103## Parent Agent Response104105After the subagent returns:106107- Summarize verdict first.108- List blocking/should-fix items, if any.109- Say whether the PR is approved.110- If the subagent found issues, ask or proceed according to the user's latest instruction; do not silently change files unless the user asked to correct them.