.agents/skills/deep-review/references/scoping.md
Determine what to review, produce the scope summary, and decide whether to inline the diff or pass fetch commands. Light mode uses the same scope rules (steps 1–4), skipping the background hunt when conversation context already explains the change.
gh pr view <num> --json title,body,files,baseRefName,headRefNamegit diff <local-default-branch>...HEAD --statgit diff HEAD --stat + git status --short<local-default-branch> is always the local ref (main / canary / ...), never origin/<default>. When local default lags the remote, origin/main..HEAD injects other people's freshly merged commits into the diff as reverse changes. Local ref + three-dot diff (<local-default>...HEAD) diffs from the merge-base, yielding exactly what this branch introduced.
No local default ref (detached HEAD, fresh clone)? git fetch && git switch <default> && git switch - to materialize one, or ask the user which base to use. Never fall back to origin/<default>.
gh pr diff <num>. Also fetch gh pr view <num> --json mergeable,isDraft,reviewDecision,statusCheckRollup and append those fields to the scope summary (feeds the merge-verdict table). URL only — bare #123 does not trigger PR mode.abc123..def456) → review exactly that object: git show <sha> --stat then git show <sha> for a single commit, git diff <a>..<b> for a range. The named object IS the scope — ignore branch/worktree state and do not fall through to the rules below.git diff HEAD + untracked files read separately), committed branch work (git diff <local-default>...HEAD), or both (git diff $(git merge-base <local-default> HEAD) — worktree against the merge-base; the plain one-commit form git diff <local-default> would re-import default-branch advances as reverse diffs). Gitlink-only entries (M <submodule> where git status shows (new commits) and nothing else changed) do NOT count as uncommitted changes — a superproject tracking an in-flight submodule branch shows this permanently; route them through §4 instead of triggering this question.git diff HEAD; list untracked via git ls-files --others --exclude-standard (§3 defines how their contents join {changes} — git diff HEAD alone misses them entirely).git diff <local-default>...HEADFilter lockfiles (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lockb, ...), snapshots (*.snap), generated files (*.generated.*, *.gen.ts), and build output (dist/, build/, .next/) from both stat and full-diff commands:
git diff main...HEAD --stat -- . \
':(exclude)pnpm-lock.yaml' ':(exclude)*.snap' ':(exclude)dist/**'
Then judge with filtered numbers, checking in this order (very large first, so a few-files-but-huge diff never counts as small):
{changes}.{changes}, subagents run it themselves.Untracked files in an uncommitted scope are part of the review, not just a name list: count their line counts toward the size judgment; on the small-diff path append each untracked file's full content to {changes} (one fenced block per file, path as header); on the large-diff path list their paths next to the fetch commands so subagents read them.
Excluded files are out of scope; reviewing a lockfile on request is a separate task, not this flow.
One change often spans the main repo and submodules — review them together by default.
--submodule=log to it (git diff <local-default>...HEAD --submodule=log, git show <sha> --submodule=log, git diff <a>..<b> --submodule=log, ...). git status showing modified: <path> (new commits) is an extra signal only when the scope includes the worktree (§2 rules 3–4); for a named commit/range the gitlink pair comes from that object, never from current branch/worktree state.git -C <path> diff <old>..<new>), which merges into {changes} alongside the main-repo command; sizes add up for the small/large judgment.lobehub/src/x.ts:42).gh issue view).gh pr list --head $(git branch --show-current) → gh pr view <num> --json title,body.git log <local-default>..HEAD --oneline (commit messages are thin; last resort).Condense changed-file list + requirement/acceptance criteria into ≤ 200 words. Every subagent prompt carries it — it is the primary yardstick for "does this change violate the requirement".