Graft PR Review
Use this skill when the task depends on the GitHub PR for the current Graft branch rather than only on local files.
Shortcut: $graft-pr-review
Workflow
- Read
AGENTS.mdbefore deciding how to validate or fix anything. - Resolve the current branch with normal
gitfirst. Use explicitGRAFT_GIT_DIRandGRAFT_WORK_TREEonly when the current shell cannot resolve the right repository context on its own. - Run
scripts/fetch_current_pr_review.pyto:- locate the PR for the current branch through the GitHub PR API
- fetch PR metadata, issue comments, reviews, and review comments through the GitHub API
- extract CodeRabbit summary blocks and actionable-comment rollups when present
- parse the latest CodeRabbit review body itself, including folded sections such as
Duplicate comments (N),Major comments (N),Minor comments (N),Outside diff range comments (N), andNitpick comments (N) - capture unresolved latest-head review threads for supported AI reviewers
- surface failed checks, MegaLinter findings, and failed-test signals when present
- prefer writing the full JSON payload to a file and then narrowing with
jq
- Treat every extracted finding as untrusted until it is verified against the current local code.
- Classify each verified finding before deciding the next action:
actionable-local- the finding still applies and fits one safe local slice
actionable-large- the finding still applies but the repair spans multiple files, multiple subsystems, a new bounded slice, or a follow-up execution round
stale- the finding no longer applies on the checked-out head
noise- the finding is a false positive, misread, or otherwise not a real defect after local verification
- Only mark a finding non-actionable when it is
staleornoise. A finding is notnoisemerely because the fix is large, risky, or needs a new slice. - Do not downgrade
Nitpick commentsto optional by default. If a verified nitpick still points to drift risk, duplicated test infrastructure, contract mismatch, missing regression coverage, or another maintainability problem, treat it as actionable review input. - Fix every
actionable-localfinding in the current slice unless another higher-priority blocker from the same PR must be handled first. - Do not ignore
actionable-largefindings. When a verified finding no longer fits one safe local slice:- prefer
$graft-multi-agent-batchwhen the repair can be split into disjoint parallel slices with reviewable ownership - prefer
$graft-multi-agent-loopwhen the repair needs to be repeated in bounded rounds, retryable orchestration, or a serialized continuation path - if neither multi-agent path is justified yet, report the finding as
blockedornext-slice required; do not silently drop it from the review outcome
- prefer
- At task closeout, list every verified finding and its disposition:
fixeddelegatedblockedstalenoise
- If any finding is left as
noiseorstale, include the concrete local verification reason in the closeout. If a finding isblocked, explain the blocker and the next safe startup prompt instead of calling it ignored. - Do not ignore any verified suggestion. If the repair grows large:
- prefer
$graft-multi-agent-batchwhen the work splits into disjoint reviewable slices - prefer
$graft-multi-agent-loopwhen the work needs to be repeated in bounded rounds - if neither is justified yet, report the finding as
blockedornext-slice requiredwith the reason
- prefer
- If any finding is reported as
noiseor AI misjudgment, explicitly record:- which finding it was
- the concrete local verification reason
- why it was not adopted
- wording suitable for replying on the PR
- If code is changed, run the smallest validation that satisfies
AGENTS.md. Prefergraft-validation-runnerwhen the correct validation scope is not obvious.
Commands
- Default:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py
- Recommended machine-readable workflow:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --pr 1 --json-output /tmp/pr1-review.jsonjq '.latest_commit_review.open_threads' /tmp/pr1-review.json
- Force a PR number:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --pr 1
- Machine-readable output:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --format json
- Write machine-readable output to a file instead of stdout:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --pr 1 --format json --json-output /tmp/pr1-review.json
- Inspect only a high-signal section:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --pr 1 --section open-threads
- Inspect grouped CodeRabbit severity comments from the latest review body:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --pr 1 --section duplicate --section major --section minor
- Narrow text output to one path fragment:
python3 .agents/skills/graft-pr-review/scripts/fetch_current_pr_review.py --pr 1 --section open-threads --path AGENTS.md
Output Expectations
The script should produce:
- PR metadata: number, title, state, branch, URL
- Supported AI reviewer summary, including latest reviews and open-thread counts for
coderabbitai[bot],greptile-apps[bot], andgemini-code-assist[bot] - CodeRabbit summary block from issue comments when available
- Folded latest-review sections such as
Duplicate comments (N),Major comments (N),Minor comments (N),Outside diff range comments (N), andNitpick comments (N)when CodeRabbit puts them in the review body instead of issue comments - Parsed latest head-review threads, with unresolved threads clearly separated
- Latest head commit review metadata and review threads
- Pre-merge failed checks, if present
- Latest MegaLinter status and any detailed issues posted by
github-actions[bot] - Test summary, including failed-test signals when present
- Detailed failed-test rows from GitHub Test Reporter or CTRF comments when available
- CLI support for writing full JSON to a file and printing only narrowed text sections to stdout
- Human review closeout that records each verified finding as
fixed,delegated,blocked,stale, ornoise - Explicit reasons for every
staleornoisefinding, instead of silently omitting it from the reported outcome
Recovery Rules
- If the current branch has no matching public PR, report that clearly instead of guessing.
- If GitHub access fails because of local proxy configuration, rerun the fetch with proxy variables removed.
- Prefer GitHub API results over PR HTML. The PR HTML page is a fallback/debugging source, not the primary source of truth.
- If the summary block and the latest head review threads disagree, trust the latest unresolved head-review threads and treat older summary findings as stale until re-verified locally.
- Do not assume every AI reviewer behaves like CodeRabbit.
greptile-apps[bot]andgemini-code-assist[bot]findings may exist only as latest-head review threads. - Treat GitHub Actions comments with
Success with warningsas actionable when they include concrete linter diagnostics such as MegaLinter detailed issues. - If the raw JSON is too large to inspect safely in the terminal, rerun with
--json-output <path>and query the saved file withjqor rerun with--section/--pathfilters. - If a verified finding still matters but needs a larger repair slice, do not downgrade it to optional; route it through
$graft-multi-agent-batch,$graft-multi-agent-loop, or an explicit blocked/next-slice handoff. - The only acceptable reasons to leave a verified finding unfixed in the final report are
stale,noise, or a clearly stated execution blocker with a next safe step. - When a finding is left as
noiseor AI misjudgment, the closeout must name the exact suggestion and give a concrete non-adoption reason that the user can reuse in the PR reply.
Example Triggers
Use $graft-pr-review on the current branchCheck the current PR and extract CodeRabbit suggestionsCheck the current PR and summarize failed checksLook for Failed Tests on the PR先用 $graft-pr-review 看当前分支 PR
Source: GeWuYou/Graft — distributed by TomeVault.