review-changes
Two passes: a fresh general-purpose subagent finds issues, then this session validates them. The reviewer must not share this session's context, so it isn't anchored on whoever wrote the code.
1. Scope
Arguments: $ARGUMENTS
Always take a baseline first, whatever the arguments, so step 4 can detect reviewer edits:
git status --porcelain{ git diff HEAD; git ls-files -o --exclude-standard -z | xargs -0 cat; } | git hash-object --stdin(status alone misses further edits to an already-modified file)
If the first word is code, staged, branch, or a ref that resolves (git rev-parse --verify <ref>), use that scope and skip the table. A ref means branch scope against that base. branch still resolves the base as below. Treat any remaining words as extra instructions for the reviewer.
Otherwise, run these in parallel:
gh pr view --json baseRefName -q .baseRefName(fails when there is no PR)git symbolic-ref --short refs/remotes/origin/HEAD
Base: the PR's baseRefName first, then origin/HEAD without the origin/ prefix, then whichever of main or master exists. Use origin/<base> if it resolves, since a stale local base pulls already-merged commits into the diff. Then run git rev-list --count <base>..HEAD.