[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X0PFP96RZXZNJ9V4T2ZJK5":3,"skill-same:01M6X0PFP96RZXZNJ9V4T2ZJK5":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M6X0PFP96RZXZNJ9V4T2ZJK5","XMC Review PR",null,"Interactive multi-agent PR review workflow enforcing code rules, open direction discussions, explicit confirmation gates, inline comment deduplication, and follow-up re-review verification.","google\u002Fxmc","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6X0MD62T1HTQNBX4VJ5AXWK",8,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_review_pr\u002FSKILL.md",[],[19,20,21,5,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"review","pr","review pr","gates","interactive","Rules","pr review","multi-agent","follow-up","inline","verification","code","workflow","deduplication","confirmation","open","up","re","direction","2026-11-10 10:12:30",false,"---\nname: XMC Review PR\ndescription: Interactive multi-agent PR review workflow enforcing code rules, open direction discussions, explicit confirmation gates, inline comment deduplication, and follow-up re-review verification.\n---\n\n# Interactive Pull Request Review Playbook\n\nThis skill provides an end-to-end multi-agent workflow for conducting comprehensive, collaborative, rule-backed reviews of GitHub Pull Requests.\n\n> [!IMPORTANT]\n> All execution steps in this skill MUST strictly adhere to the mandatory policy rules defined in [PR Review Guidelines](..\u002F..\u002Frules\u002Fpr_review_guidelines.md), [Core Engineering Standards](..\u002F..\u002Frules\u002Fcore_engineering.md), [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md), and file-extension language guidelines under `rules\u002Flanguages\u002F`.\n\n---\n\n## Architecture & Workflow Overview\n\n```mermaid\ngraph TD\n    A[\"User triggers XMC Review PR\"] --> B[\"Agent runs review_pr_generate_audit.py (fetches and checks out the PR head)\"]\n    B --> C{\"Select Operational Mode\"}\n    C -->|\"Mode A: Initial Review\"| D[\"Phase 1: Open User Direction Discussion Window\"]\n    D --> E[\"Phase 2: Dynamic Expert Subagent Panel (Critical Thinking & Passable 'No Findings')\"]\n    E --> F[\"Phase 3: Generate Interactive Audit Checklist (pr_review_audit_checklist.md in session dir)\"]\n    F --> G[\"Phase 4: Mandatory Explicit Confirmation Gate (Y\u002Fn)\"]\n    G --> H[\"Phase 5: Strictly Inline Posting (review_pr_post_inline_comment.py)\"]\n    H --> I[\"Phase 6: 1-to-1 Posted Verification (review_pr_verify_posted.py)\"]\n\n    C -->|\"Mode B: Re-Review\"| J[\"Phase 1: Author Reply & Delta Inspection\"]\n    J -->|\"full_review_recommended\"| D\n    J --> K[\"Phase 2: Evaluate Author Claims, Pushback & Substantial Deltas\"]\n    K --> L[\"Phase 3: Markdown Iteration Report (pr_rereview_audit_report.md in session dir)\"]\n    L --> M[\"Phase 4: Explicit Confirmation Gate for Resolving\u002FCounter-Replying\"]\n    M --> N[\"Phase 5: Batch Thread Reply & Resolution Execution\"]\n    N --> O[\"Phase 6: Programmatic Resolution Verification\"]\n```\n\n---\n\n## Guidelines for Using Helper CLI Tools (`tools\u002Fpr_review\u002Freview_pr_*.py`)\n\nWhen invoking helper CLI scripts under `tools\u002Fpr_review\u002F` (`review_pr_generate_audit.py`, `review_pr_post_inline_comment.py`, `review_pr_verify_posted.py`):\n1. **Do not read tool source code**: Refer to [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md#5-helper-tool-execution-policy--safety-constraints).\n2. **Inspect parameters via `--help`**: Run tools with `--help` to inspect parameter schemas and usage flags.\n3. **Parse Structured JSON Output**: Tools output structured JSON; check the exit code per [Helper Tool Exit Codes](..\u002F..\u002FAGENTS.md#universal-architectural-principles).\n4. **Store Artifacts strictly inside a Session Scratch Directory (`--out-dir`)**: All generated markdown audit checklists, reports, and review inputs (`pr.diff`, `pr_meta.json`, `review_threads.json`) go to a session scratch directory outside the repository (`\u003Csession_scratch_dir>`) rather than the workspace root to prevent accidental git repository commits.\n5. **Virtual Environment & Execution Safety**: Invoke tools with plain `python3`. All `review_pr_*.py` tools rely **strictly on standard library modules (`argparse`, `pathlib`, `json`, `re`, `subprocess`, `urllib`) + `gh` CLI**, so they execute deterministically in any Python environment and need no virtual environment (see [Python Guidelines](..\u002F..\u002Frules\u002Flanguages\u002Fpython.md#4-virtual-environments--execution-safety) for tools that do).\n6. **Arbitrary Long Comment File Safety (`-f` \u002F `--message-file`)**: Always write proposed inline review comments containing markdown diff blocks or detailed explanations to a file and pass `-f message_file.md` to prevent bash escaping errors or length truncation.\n7. **Run helpers from a trusted checkout**: Every `tools\u002Fpr_review\u002F...` command in this skill (Mode A and Mode B) means `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002F...`, run with cwd at `\u003Creview_dir>`. `\u003Ctrusted_repo>` is a checkout you trust (e.g. your up-to-date `main`), never the review worktree. After `--checkout` a review worktree sits at a PR head (on a re-review, the previous round's head), so relative paths would run PR-authored helpers with your GitHub credentials.\n\n---\n\n## Mode A: Initial PR Review & Collaborative Scoping\n\n### Phase 1: Open User Direction Discussion Window (\"Where should I look?\")\n\nBefore launching deep code analysis or subagent review panels, the agent must inspect basic PR metadata and open an interactive dialogue with the reviewer:\n\n1. **Run Initial Audit Script at the PR Head**:\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_generate_audit.py \u003Cowner> \u003Crepo> \u003Cpr_number> --mode initial \\\n       --out-dir \u003Csession_scratch_dir> --checkout\n   ```\n   *This fetches PR details, diff file touchpoints, extracts task or issue references (#123, issue links) from the description, indexes existing inline comments for deduplication, initializes the **Core 8-Pillar Baseline Audit Matrix (with explicit N\u002FA resolution)**, and creates `pr_review_audit_checklist.md` plus its machine-readable sidecar `pr_review_audit_checklist.json` inside `\u003Csession_scratch_dir>` (a directory outside the repository).*\n\n   *With `--out-dir` it also fetches `pull\u002F\u003Cpr_number>\u002Fhead` and writes the review inputs there: `pr.diff` (base...head), `pr_meta.json` (base\u002Fhead refs and SHAs, file list with +\u002F- counts), and `review_threads.json`. `--checkout` checks the PR head out detached so every file you read is the PR's version. When tracked files have local changes, or git refuses the checkout (e.g. an untracked file sits at a path the PR adds), it skips the checkout and returns `checked_out: false` plus the exact `checkout_command`; it never discards local work. Commit or stash, then run that command, or review from `pr.diff` only. The tool runs every git command with hooks disabled (`-c core.hooksPath=\u002Fdev\u002Fnull`), and `checkout_command` carries the same flag.*\n\n   *`--checkout` moves HEAD of the worktree you run it in, so relative `tools\u002F` paths then point at the PR's version of the helpers. Prefer a dedicated review worktree (`git -c core.hooksPath=\u002Fdev\u002Fnull worktree add --detach \u003Creview_dir>`) and run with cwd at `\u003Creview_dir>`. When reviewing in your own worktree, note the current branch first and return with `git -c core.hooksPath=\u002Fdev\u002Fnull switch -` after the review. Run every helper by absolute path from your trusted checkout, never by relative path (guideline 7). Whenever you run git yourself against a tree that contains or contained PR files, pass `-c core.hooksPath=\u002Fdev\u002Fnull`. With a relative `core.hooksPath` such as `.githooks`, git otherwise runs the PR's hooks with your credentials.*\n\n   - **Read-Only Fetch-First Inspection**: Throughout Phase 1 and Phase 2 subagent reviews, follow [Non-Mutating Fetch-First PR Inspection](..\u002F..\u002Frules\u002Fpr_review_guidelines.md#1-code-review--inspection-guidelines). The command above already fetches `pull\u002F\u003Cpr_number>\u002Fhead` and only checks it out in a clean worktree. When the checkout was skipped, inspect files via `git show \u003Chead_sha>:\u003Cpath>` or a detached worktree (`git -c core.hooksPath=\u002Fdev\u002Fnull worktree add --detach \u003Ctmp_dir> \u003Chead_sha>`) rather than running `gh pr checkout` in a dirty workspace or reading unchecked-out local working-tree paths.\n\n   > [!IMPORTANT]\n   > Never review PR files from a worktree that is not at `pr_meta.json`'s `head_sha`. Take base\u002Fhead SHAs and the diff from `pr_meta.json` and `pr.diff`; do not guess `gh pr view --json` field names (`baseRefOid` does not exist on older `gh` releases) or chain `gh`\u002F`git rev-parse` calls.\n\n2. **Present Scoping Summary & Open Direction Window**:\n   Display PR metadata, touched package matrix, task references, and ask the user for guidance **before launching subagent reviews**:\n   > *\"I have fetched metadata for PR #\u003Cpr_number>: **\u003CTitle>**.*\n   > *- **Base ← Head**: `\u003Cbase>` ← `\u003Chead>` (`\u003Csha>`)*\n   > *- **Referenced Tasks\u002FBugs**: `\u003Cbug_references>`*\n   > *- **Modified Packages**: `pkg\u002Fauth`, `cmd\u002Fxid_service`, etc.*\n   > *- **Existing Inline Threads Indexed**: \u003Ccount> threads (deduplication active)*\n   > \n   > *Before I launch our expert review panel, please let me know:*\n   > 1. *Are there specific subsystems, security boundaries, or edge cases you want the review panel to focus on?*\n   > 2. *Do you have initial inline feedback or direction where you'd like me to look?*\n   > 3. *Should I give special attention to API \u002F configuration contract compatibility?\"*\n\n---\n\n### Phase 2: Dynamic Expert Subagent Panel & Rule Alignment\n\nOnce the user provides initial directional guidance (or confirms to proceed), the Main Orchestrator dynamically spawns specialized reviewer subagents tailored to the modified file types.\n\n#### Reviewer Inputs & Tool Access\n- Give every reviewer the absolute paths of `pr.diff`, `pr_meta.json`, and `review_threads.json` from `\u003Csession_scratch_dir>`, plus the `head_sha`. Reviewers that only read files can review from these inputs. When `pr_meta.json` has `threads_error`, the thread fetch failed and `review_threads.json` is not authoritative: tell reviewers, and deduplicate against the PR on GitHub instead.\n- Reviewers that must run code (tests, `git log`\u002F`git blame`, builds) need a shell and must work in a worktree at `head_sha`. Do not hand such tasks to read-only reviewers; run the command yourself and pass them the output instead.\n\n#### Hybrid Baseline Rubric + Dynamic Specialist Role Architecture\nTo eliminate **stochastic omission variance** (where dynamic subagents might forget core engineering principles) while retaining deep subsystem expertise, every PR code review enforces a **Hybrid Evaluation Architecture**:\n\n1. **Deterministic Core 8-Pillar Baseline Audit Matrix (`with explicit N\u002FA resolution`)**: Every PR review artifact (`pr_review_audit_checklist.md`) incorporates a deterministic inspection rubric covering:\n   - **Pillar 1: Linear Control Flow & Guard Clauses** (`core_engineering.md#2-kiss`)\n   - **Pillar 2: Single Responsibility Principle & Target Complexity Limit** (`core_engineering.md#1-srp`)\n   - **Pillar 3: Defensive Input Validation & Boundary Checks** (`core_engineering.md`)\n   - **Pillar 4: Concurrency & `context.Context` Propagation Safety** (`golang.md` \u002F `python.md`)\n   - **Pillar 5: Test Double Fidelity & Deterministic Test Execution** (`core_engineering.md#4`)\n   - **Pillar 6: Backward Compatibility & Contract Protection** (`core_engineering.md`)\n   - **Pillar 7: Dependency Graph & Build System Boundaries** (`core_engineering.md`)\n   - **Pillar 8: Documentation & Contract Alignment** (`core_engineering.md#5`)\n   *Crucially, every pillar MUST be evaluated as either an `ACTIONABLE FINDING`, `COMPLIANT \u002F PASS`, or `- [ ] N\u002FA — Subsystem \u002F pattern not touched by PR` with brief rationale, ensuring zero silent omissions.*\n\n2. **Mandatory Subagent**: The review panel MUST always include a dedicated **`PR Description & Task Reference Reconciliation Specialist`**, tasked with evaluating whether the actual git diff matches what the PR title and description claim to do, and verifying that referenced task references, issue links, or design specs are fulfilled.\n3. **Dynamic Domain Subagents (Synthesized by Agent)**: Subagents must NOT concentrate solely on line-by-line code mechanics. When main dependency pillars, workload orchestrators, or scheduling subsystems are touched, the agent should dynamically craft specialized domain expert subagent roles (1–3 roles with tightly scoped prompts). Examples include (but are not limited to):\n   * *Example (Scheduling & Workload Dependency Pillar)*: `Kueue Expert \u002F Subsystem Specialist` auditing `ClusterQueue`, `LocalQueue`, Workunit resource reservation, quota enforcement, preemptor interaction, and Kueue CRD updates whenever scheduling or workload actuation is touched.\n   * *Example (Kubernetes Infrastructure Pillar)*: `Kubernetes (K8s) Expert Specialist` evaluating controller-runtime reconciler loops, informer cache synchronization, RBAC ClusterRole permissions, pod disruption budgets, and GKE lifecycle behavior whenever K8s resources, CRDs, or Helm charts are touched.\n   * *Example (Go Backend)*: `Go Concurrency & Interface Safety Reviewer` checking `context.Context` propagation, mutex boundaries, and test double fidelity (`prototest.Modify`).\n   * *Example (Python Tooling)*: `Python CLI & Shell Injection Security Reviewer` auditing standard library preferences, error handling, and argument escaping.\n   * *Example (UI Frontend)*: `Modern Angular Signal & Immutability Reviewer` verifying declarative template patterns and state immutability.\n   * *Example (Infrastructure \u002F API)*: `Protobuf & Helm Backward-Compatibility Reviewer` verifying breaking schema or deployment changes.\n\n#### Strict Directives for Subagent Prompting\nAll expert subagents invoked during Phase 2 MUST receive the following mandatory guidelines:\n1. **Critical Thinking Required**: Apply genuine engineering critical thinking. Do not output trivial mechanical formatting comments or stylistic preferences.\n2. **\"No Findings\" is a Passable and Respected Result**: Expressly instruct subagents:\n   > *\"Returning 'No actionable findings — code cleanly complies with project rules and guidelines' is a valid, high-value engineering conclusion. Do NOT manufacture artificial issues or exaggerate minor stylistic choices just to return findings.\"*\n3. **PR Description & Requirement Audit**: Verify whether code modifications actually achieve what the author stated in the PR title, description, and referenced task definitions.\n4. **Strict Inline Deduplication & Already-Resolved Thread Governance**:\n   - Inspect the supplied existing comment index (`comments`) and **never generate duplicate inline comments** for problems already raised on the PR.\n   - **Already Resolved Threads on GitHub UI (`[RESOLVED ON GITHUB]`)**: Treat threads marked resolved on GitHub as closed engineering decisions. Do NOT re-open or propose duplicate inline comments unless a new commit explicitly regressed that exact file line.\n5. **Strict Mock & Fixture Isolation Audit**: Explicitly audit production files for mock data leakage. Production components, handlers, and service files must NEVER contain static mock datasets, sample entities, or fallback mock branching. All test doubles and fixtures belong strictly in dedicated test files (`*_test.ts`, `*_test.go`, `test_*.py`) or testing helpers (`cmd\u002Fui\u002Fapp\u002Ftesting\u002Fmock_*.ts`, `test\u002Ffixtures\u002F`) per `core_engineering.md#4`.\n\n---\n\n### Phase 3: Generate Interactive Audit Checklist Artifact (`pr_review_audit_checklist.md`)\n\nAfter subagents complete their reviews, the Main Orchestrator synthesizes findings, filters out duplicate\u002Ftrivial comments, and formats the Interactive Audit Checklist inside `\u003Csession_scratch_dir>\u002Fpr_review_audit_checklist.md`.\n\nCrucially, the Main Orchestrator MUST partition every finding into **two distinct scope categories** based on git diff patch boundaries:\n1. **Group A: Inline PR Diff Patch Items (`Patch-In-Scope`)**: Target lines that were actually modified or added in the PR diff patch. These can be posted directly as inline GitHub diff comments (`tools\u002Fpr_review\u002Freview_pr_post_inline_comment.py`).\n2. **Group B: Out-of-Diff Scope Observations (`Unchanged-Line-Out-of-Scope`)**: Target unchanged surrounding lines in modified files outside the PR diff patch. Because GitHub's inline comment API rejects non-diff lines with 422 errors, these **cannot be posted as inline review comments**.\n\nEach proposed item in `pr_review_audit_checklist.md` must specify:\n* **Item ID** (`#1`, `#2`, ...)\n* **Scope Classification**: `[Group A: Inline Patch]` vs `[Group B: Out-of-Diff Scope]`\n* **Status**: `Draft` (default until user confirms)\n* **File Path & Line Number** (with patch vs unchanged line status clearly flagged)\n* **Rule Reference** (canonical path, e.g., `core_engineering.md#1-single-responsibility-principle` or `pr_review_guidelines.md#1-code-review--inspection-guidelines`)\n* **Priority**: `Blocker` \u002F `Actionable Optimization` \u002F `Clarity Question` \u002F `Nit`\n* **Proposed Inline Comment Text** (with concrete git diff block suggestions where applicable)\n\n#### JSON Sidecar: Source of Truth for Item Status\n`review_pr_verify_posted.py` reads proposed items from `pr_review_audit_checklist.json` (falling back to the markdown only when no sidecar exists) and fails when it finds zero approved items. Keep the markdown for human reading, and record every Group A item in the sidecar's `items` list by rewriting the whole JSON file (never exact-match edits of table cells):\n\n```json\n{\"item_id\": \"#1\", \"type\": \"initial_inline\", \"status\": \"Draft\", \"file_path\": \"pkg\u002Fauth\u002Fhandler.go\", \"line\": 152, \"rule\": \"core_engineering.md#2-kiss\", \"proposed\": \"Use an early guard return.\"}\n```\n\nAfter the Phase 4 confirmation, rewrite confirmed items with `\"status\": \"Approved\"`. Never set `Posted` by hand: use `--mark-posted` (Phase 5) or the verification run (Phase 6).\n\n---\n\n### Phase 4: Mandatory Explicit Confirmation Gate (Zero Unconfirmed or Misleading Posting)\n\n> [!WARNING]\n> **Strict Anti-Jumping & No-Omission Guardrail**: The agent MUST NEVER execute inline comment posting scripts without explicit user confirmation, and MUST NEVER ask an ambiguous question that claims to post `#1 through #8` when items outside the PR diff patch cannot be posted inline.\n\nWhen asking for Phase 4 confirmation, the agent MUST present both tables separately and ask an **explicit partitioned question**:\n\n> *\"I have synthesized our review findings into `pr_review_audit_checklist.md` inside your session folder, partitioned by GitHub PR patch scope:*\n> \n> *### **Group A: Postable Inline PR Diff Patch Comments (Postable Inline)** (4 items)*\n> *| Item | Priority | File & Line | Rule Reference | Summary of Proposed Inline Comment |*\n> *| :--- | :--- | :--- | :--- | :--- |*\n> *| `#1` | Actionable | `pkg\u002Fauth\u002Fhandler.go`:L152 (Patch Line) | `core_engineering.md` | Avoid nested if-else with early guard returns |*\n> *| `#2` | Blocker | `cmd\u002Fxid_service\u002Fmain.go`:L88 (Patch Line) | `core_engineering.md` | Test constructor bypasses nil double |*\n> \n> *### **Group B: Out-of-Diff Scope Observations (Unchanged Lines in Touched Files)** (4 items)*\n> *| Item | Priority | File & Line | Rule Reference | Architectural Observation Summary |*\n> *| :--- | :--- | :--- | :--- | :--- |*\n> *| `#5` | Nit | `pkg\u002Fauth\u002Fhandler.go`:L210 (Unchanged Line) | `core_engineering.md` | Legacy struct field name inconsistency |*\n> *| `#6` | Actionable | `cmd\u002Fxid_service\u002Fmain.go`:L12 (Unchanged Line) | `core_engineering.md` | Dead helper constant outside modified PR diff |*\n> \n> *> [!IMPORTANT]*\n> *> **Posting Scope Clarification**: GitHub's inline review API only supports posting inline comments on changed patch lines (Group A). Group B items cannot be posted inline; by default, they are recorded and tracked exclusively in our session checklist artifact so they do not clutter the PR.*\n> \n> *Please confirm:*\n> *1. **Shall I proceed with posting Group A inline PR comments (#1 through #4) on GitHub?** (`Y`\u002F`n` \u002F modify `#X`)*\n> *2. **Do you want to include any critical Group B out-of-diff items (#5 through #8) as an overall PR summary comment?** (Default is **No** — omit from PR and keep strictly in session checklist artifact unless you explicitly specify critical items to include)*\"\n\n---\n\n### Phase 5: Strictly Inline Posting (`tools\u002Fpr_review\u002Freview_pr_post_inline_comment.py`)\n\nComments MUST always be posted inline on specific PR diff lines. Never post generic PR-level spam unless explicitly requested.\n\nFor each user-approved item:\n1. Write the proposed inline markdown comment to a temporary file (`comment_body.md`). Include the item's sidecar `proposed` text verbatim (e.g. as the first sentence); Phase 6 matches on it.\n2. Run the posting script:\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_post_inline_comment.py \u003Cowner> \u003Crepo> \u003Cpr_number> \\\n       --commit-id \u003Chead_commit_sha> \\\n       --path \u003Cfile_path> \\\n       --line \u003Cline_number> \\\n       -f comment_body.md\n   ```\n3. Record the item as posted (updates the sidecar and the markdown table; no hand edits):\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> \\\n       -c \u003Csession_scratch_dir>\u002Fpr_review_audit_checklist.md --mark-posted '#1'\n   ```\n\n---\n\n### Phase 6: Programmatic 1-to-1 Posted Verification Check\n\nBefore completing the review session:\n1. Execute programmatic verification against the checklist artifact:\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> \\\n       -c \u003Csession_scratch_dir>\u002Fpr_review_audit_checklist.md\n   ```\n2. Verify that 100% of approved initial inline review comments appear on the live GitHub PR diff. An item counts only when a comment on its file and line is authored by the authenticated `gh` \u002F `GITHUB_TOKEN` user and contains the item's `proposed` text (whitespace, case, backticks, and asterisks are ignored). A non-zero exit with `No approved items found` means the sidecar was never populated; fix the sidecar instead of editing the markdown.\n3. The tool sets verified items to `Posted` in the sidecar and markdown itself; do not edit statuses by hand.\n\n---\n\n## Mode B: Follow-Up Re-Review & Author Reply Verification Flow\n\nTriggered when reviewing a Pull Request where the author has replied to earlier comments or pushed follow-up commits.\n\n### Phase 1: Pull Author Replies & Diff Deltas\nRun the audit generator script in `re-review` mode at the PR head, with cwd at `\u003Creview_dir>`:\n```bash\npython3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_generate_audit.py \u003Cowner> \u003Crepo> \u003Cpr_number> --mode re-review \\\n    --out-dir \u003Csession_scratch_dir> --checkout\n```\n\n> [!WARNING]\n> On a re-review, `\u003Creview_dir>` is still checked out at the **previous** round's PR head, so its `tools\u002F` are PR-authored. Always use the `\u003Ctrusted_repo>\u002F` path above, never `tools\u002F...` relative to `\u003Creview_dir>` (guideline 7).\n\n*This generates `pr_rereview_audit_report.md` inside `\u003Csession_scratch_dir>` indexing every open review thread, original reviewer text, and author response, plus the sidecar `pr_rereview_audit_report.json` listing each root thread with `\"action\": null`. When recommending an action, rewrite the sidecar with `\"action\": \"RESOLVE\"` or `\"action\": \"RESPOND\"` for that thread; threads left `null` are skipped by verification. It also writes the same review inputs as Mode A (`pr.diff`, `pr_meta.json`, `review_threads.json`) and checks out the PR head under the same dirty-worktree rule.*\n\n*The output's `rereview_delta` (also in `pr_meta.json` and the report header) counts lines changed since the commit of your latest real review (override with `--since-sha`). Pending drafts are ignored, and so are the empty reviews GitHub creates to wrap standalone thread replies, because those are pinned to the head at reply time rather than to reviewed code. Without an earlier review, or when that commit cannot be compared, the size is unknown; after a rebase or force-push it is usually over-counted. Both cases set `full_review_recommended` to `true`.*\n\n> [!IMPORTANT]\n> **Escalate on a large delta**: When `full_review_recommended` is `true` (more than `--full-review-threshold` changed lines, default 200, or unknown), run a full Mode A review on the new head in addition to the thread checks below, and tell the user why. Never limit a re-review to old threads when most of the code is new.\n\n### Phase 2: Evaluate Author Claims, Pushback & Substantial Deltas\n\nFor every discussion thread indexed in the audit report, apply critical engineering evaluation across **4 governance buckets**:\n\n1. **Bucket 1: Already Resolved on GitHub UI (`is_resolved == True`)**:\n   - **Policy**: **Respect & Skip.** Human reviewer explicitly clicked \"Resolve conversation\" on GitHub. List in `pr_rereview_audit_report.md` as `[ALREADY RESOLVED ON GITHUB]` requiring **zero action**.\n2. **Bucket 2: Author Claims \"Applied \u002F Fixed\" on Open Thread**:\n   - Inspect the latest diff delta at that line and file path: `git diff \u003Crereview_delta.since_sha> \u003Chead_sha> -- \u003Cpath>` when `since_sha` is known (run `git -c core.hooksPath=\u002Fdev\u002Fnull fetch \u003Cremote> \u003Csince_sha>` first if it is not local, e.g. after a force-push), else `pr.diff`.\n   - **Verification**: Verify whether the fix was *actually applied cleanly and correctly* or if it introduced edge-case regressions.\n   - **Outcome Classification**:\n     * *Verified Fixed*: Mark `\u003CAudit Verification Status: - [x] Verified Fixed>` and propose Recommended Action: `[RESOLVE]` with justification.\n     * *Claimed Fixed but Flawed\u002FIncomplete*: Mark `\u003CAudit Verification Status: - [ ] Flawed Fix>` and propose Recommended Action: `[RESPOND: \u003Cproposed concrete follow-up diff recommendation>]`.\n3. **Bucket 3: Author Pushes Back \u002F Disagrees on Open Thread**:\n   - Evaluate the author's argument against [Core Engineering Standards](..\u002F..\u002Frules\u002Fcore_engineering.md) and security principles.\n   - **Outcome Classification**:\n     * *Pushback is Valid*: Propose Recommended Action: `[RESOLVE]` acknowledging the author's design trade-off.\n     * *Pushback is Invalid \u002F Missing Context*: Propose Recommended Action: `[RESPOND: \u003Ctechnical rationale & reference to rules>]`.\n4. **Bucket 4: Substantial Code Delta Pushed**:\n   - If the author refactored major modules or added new code to address comments (see `rereview_delta.changed_files`), spawn a dedicated delta review subagent on the newly modified code. Above the threshold, escalate to the full Mode A review described in Phase 1.\n\n### Phase 3: Structured Markdown Iteration Report (`pr_rereview_audit_report.md`)\n\nPresent all thread verification findings inside `\u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md` with explicit action proposals:\n\n````markdown\n### Thread ID `101` (`pkg\u002Fauth\u002Fhandler.go`:L152)\n- **Original Reviewer**: *Avoid nested if-else*\n- **Author Reply**: *\"Applied early guard returns in commit abc1234\"*\n- **Audit Verification Outcome**: **Verified Applied** (Line 152 now uses clean linear guard clauses per `core_engineering.md`).\n- **Proposed Action**: `[RESOLVE]`\n\n---\n\n### Thread ID `102` (`cmd\u002Fxid_service\u002Fmain.go`:L88)\n- **Original Reviewer**: *Test double bypasses nil dependency*\n- **Author Reply**: *\"Pushing back: nil mock is sufficient for unit test\"*\n- **Audit Verification Outcome**: **Pushback Invalid** (Per `core_engineering.md#4`, test constructors must provide high-fidelity doubles; nil silently disables metric Recorders).\n- **Proposed Action**: `[RESPOND]`\n- **Proposed Counter-Reply**:\n  ```markdown\n  While a nil mock avoids compile errors, `GatewayMetrics` recording silently drops metric counters during unit tests (see `core_engineering.md#4`). Please inject `NewTestMetricsRecorder()` so test assertions can verify telemetry recording.\n  ```\n````\n\n#### Asynchronous User Markdown Iteration Loop\nBecause the re-review analysis is saved as a markdown document in `\u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md`, **you can edit this file directly in your workspace**—changing proposed actions from `[RESPOND]` to `[RESOLVE]` or tuning counter-reply text—so the agent iterates asynchronously without losing thread state.\n\n### Phase 4: Explicit Confirmation Gate & Batch Action Execution\n* The agent asks for explicit confirmation:\n  > *\"Please inspect `pr_rereview_audit_report.md`. Shall I proceed with posting recommended counter-replies and resolving verified threads on PR #\u003Cpr_number>? (Y\u002Fn)\"*\n* For every confirmed thread:\n  * If `[RESPOND]`: Invoke `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_post_inline_comment.py \u003Cowner> \u003Crepo> \u003Cpr_number> --in-reply-to \u003Cthread_id> -f counter_reply.md`.\n  * If `[RESOLVE]`: Invoke `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_post_inline_comment.py \u003Cowner> \u003Crepo> \u003Cpr_number> --resolve-thread \u003Cthread_id>` to resolve verified threads programmatically via GitHub GraphQL. To inspect current thread state (thread IDs, `path:line`, resolution, whether you replied), run `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_threads.py list \u003Cowner> \u003Crepo> \u003Cpr_number>`; never hand-write `gh api graphql` calls.\n* After resolving a thread, record it with `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> -c \u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md --mark-posted \u003Cthread_id>`.\n* Run programmatic verification check (`\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> -c \u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md`). A `RESPOND` thread passes only when the authenticated user replied to it. A `RESOLVE` thread passes only when GitHub reports it resolved; a reply, a `Posted` status, or a `[x]` marker alone is not sufficient.\n","# Interactive Pull Request Review Playbook\n\nThis skill provides an end-to-end multi-agent workflow for conducting comprehensive, collaborative, rule-backed reviews of GitHub Pull Requests.\n\n> [!IMPORTANT]\n> All execution steps in this skill MUST strictly adhere to the mandatory policy rules defined in [PR Review Guidelines](..\u002F..\u002Frules\u002Fpr_review_guidelines.md), [Core Engineering Standards](..\u002F..\u002Frules\u002Fcore_engineering.md), [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md), and file-extension language guidelines under `rules\u002Flanguages\u002F`.\n\n---\n\n## Architecture & Workflow Overview\n\n```mermaid\ngraph TD\n    A[\"User triggers XMC Review PR\"] --> B[\"Agent runs review_pr_generate_audit.py (fetches and checks out the PR head)\"]\n    B --> C{\"Select Operational Mode\"}\n    C -->|\"Mode A: Initial Review\"| D[\"Phase 1: Open User Direction Discussion Window\"]\n    D --> E[\"Phase 2: Dynamic Expert Subagent Panel (Critical Thinking & Passable 'No Findings')\"]\n    E --> F[\"Phase 3: Generate Interactive Audit Checklist (pr_review_audit_checklist.md in session dir)\"]\n    F --> G[\"Phase 4: Mandatory Explicit Confirmation Gate (Y\u002Fn)\"]\n    G --> H[\"Phase 5: Strictly Inline Posting (review_pr_post_inline_comment.py)\"]\n    H --> I[\"Phase 6: 1-to-1 Posted Verification (review_pr_verify_posted.py)\"]\n\n    C -->|\"Mode B: Re-Review\"| J[\"Phase 1: Author Reply & Delta Inspection\"]\n    J -->|\"full_review_recommended\"| D\n    J --> K[\"Phase 2: Evaluate Author Claims, Pushback & Substantial Deltas\"]\n    K --> L[\"Phase 3: Markdown Iteration Report (pr_rereview_audit_report.md in session dir)\"]\n    L --> M[\"Phase 4: Explicit Confirmation Gate for Resolving\u002FCounter-Replying\"]\n    M --> N[\"Phase 5: Batch Thread Reply & Resolution Execution\"]\n    N --> O[\"Phase 6: Programmatic Resolution Verification\"]\n```\n\n---\n\n## Guidelines for Using Helper CLI Tools (`tools\u002Fpr_review\u002Freview_pr_*.py`)\n\nWhen invoking helper CLI scripts under `tools\u002Fpr_review\u002F` (`review_pr_generate_audit.py`, `review_pr_post_inline_comment.py`, `review_pr_verify_posted.py`):\n1. **Do not read tool source code**: Refer to [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md#5-helper-tool-execution-policy--safety-constraints).\n2. **Inspect parameters via `--help`**: Run tools with `--help` to inspect parameter schemas and usage flags.\n3. **Parse Structured JSON Output**: Tools output structured JSON; check the exit code per [Helper Tool Exit Codes](..\u002F..\u002FAGENTS.md#universal-architectural-principles).\n4. **Store Artifacts strictly inside a Session Scratch Directory (`--out-dir`)**: All generated markdown audit checklists, reports, and review inputs (`pr.diff`, `pr_meta.json`, `review_threads.json`) go to a session scratch directory outside the repository (`\u003Csession_scratch_dir>`) rather than the workspace root to prevent accidental git repository commits.\n5. **Virtual Environment & Execution Safety**: Invoke tools with plain `python3`. All `review_pr_*.py` tools rely **strictly on standard library modules (`argparse`, `pathlib`, `json`, `re`, `subprocess`, `urllib`) + `gh` CLI**, so they execute deterministically in any Python environment and need no virtual environment (see [Python Guidelines](..\u002F..\u002Frules\u002Flanguages\u002Fpython.md#4-virtual-environments--execution-safety) for tools that do).\n6. **Arbitrary Long Comment File Safety (`-f` \u002F `--message-file`)**: Always write proposed inline review comments containing markdown diff blocks or detailed explanations to a file and pass `-f message_file.md` to prevent bash escaping errors or length truncation.\n7. **Run helpers from a trusted checkout**: Every `tools\u002Fpr_review\u002F...` command in this skill (Mode A and Mode B) means `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002F...`, run with cwd at `\u003Creview_dir>`. `\u003Ctrusted_repo>` is a checkout you trust (e.g. your up-to-date `main`), never the review worktree. After `--checkout` a review worktree sits at a PR head (on a re-review, the previous round's head), so relative paths would run PR-authored helpers with your GitHub credentials.\n\n---\n\n## Mode A: Initial PR Review & Collaborative Scoping\n\n### Phase 1: Open User Direction Discussion Window (\"Where should I look?\")\n\nBefore launching deep code analysis or subagent review panels, the agent must inspect basic PR metadata and open an interactive dialogue with the reviewer:\n\n1. **Run Initial Audit Script at the PR Head**:\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_generate_audit.py \u003Cowner> \u003Crepo> \u003Cpr_number> --mode initial \\\n       --out-dir \u003Csession_scratch_dir> --checkout\n   ```\n   *This fetches PR details, diff file touchpoints, extracts task or issue references (#123, issue links) from the description, indexes existing inline comments for deduplication, initializes the **Core 8-Pillar Baseline Audit Matrix (with explicit N\u002FA resolution)**, and creates `pr_review_audit_checklist.md` plus its machine-readable sidecar `pr_review_audit_checklist.json` inside `\u003Csession_scratch_dir>` (a directory outside the repository).*\n\n   *With `--out-dir` it also fetches `pull\u002F\u003Cpr_number>\u002Fhead` and writes the review inputs there: `pr.diff` (base...head), `pr_meta.json` (base\u002Fhead refs and SHAs, file list with +\u002F- counts), and `review_threads.json`. `--checkout` checks the PR head out detached so every file you read is the PR's version. When tracked files have local changes, or git refuses the checkout (e.g. an untracked file sits at a path the PR adds), it skips the checkout and returns `checked_out: false` plus the exact `checkout_command`; it never discards local work. Commit or stash, then run that command, or review from `pr.diff` only. The tool runs every git command with hooks disabled (`-c core.hooksPath=\u002Fdev\u002Fnull`), and `checkout_command` carries the same flag.*\n\n   *`--checkout` moves HEAD of the worktree you run it in, so relative `tools\u002F` paths then point at the PR's version of the helpers. Prefer a dedicated review worktree (`git -c core.hooksPath=\u002Fdev\u002Fnull worktree add --detach \u003Creview_dir>`) and run with cwd at `\u003Creview_dir>`. When reviewing in your own worktree, note the current branch first and return with `git -c core.hooksPath=\u002Fdev\u002Fnull switch -` after the review. Run every helper by absolute path from your trusted checkout, never by relative path (guideline 7). Whenever you run git yourself against a tree that contains or contained PR files, pass `-c core.hooksPath=\u002Fdev\u002Fnull`. With a relative `core.hooksPath` such as `.githooks`, git otherwise runs the PR's hooks with your credentials.*\n\n   - **Read-Only Fetch-First Inspection**: Throughout Phase 1 and Phase 2 subagent reviews, follow [Non-Mutating Fetch-First PR Inspection](..\u002F..\u002Frules\u002Fpr_review_guidelines.md#1-code-review--inspection-guidelines). The command above already fetches `pull\u002F\u003Cpr_number>\u002Fhead` and only checks it out in a clean worktree. When the checkout was skipped, inspect files via `git show \u003Chead_sha>:\u003Cpath>` or a detached worktree (`git -c core.hooksPath=\u002Fdev\u002Fnull worktree add --detach \u003Ctmp_dir> \u003Chead_sha>`) rather than running `gh pr checkout` in a dirty workspace or reading unchecked-out local working-tree paths.\n\n   > [!IMPORTANT]\n   > Never review PR files from a worktree that is not at `pr_meta.json`'s `head_sha`. Take base\u002Fhead SHAs and the diff from `pr_meta.json` and `pr.diff`; do not guess `gh pr view --json` field names (`baseRefOid` does not exist on older `gh` releases) or chain `gh`\u002F`git rev-parse` calls.\n\n2. **Present Scoping Summary & Open Direction Window**:\n   Display PR metadata, touched package matrix, task references, and ask the user for guidance **before launching subagent reviews**:\n   > *\"I have fetched metadata for PR #\u003Cpr_number>: **\u003CTitle>**.*\n   > *- **Base ← Head**: `\u003Cbase>` ← `\u003Chead>` (`\u003Csha>`)*\n   > *- **Referenced Tasks\u002FBugs**: `\u003Cbug_references>`*\n   > *- **Modified Packages**: `pkg\u002Fauth`, `cmd\u002Fxid_service`, etc.*\n   > *- **Existing Inline Threads Indexed**: \u003Ccount> threads (deduplication active)*\n   > \n   > *Before I launch our expert review panel, please let me know:*\n   > 1. *Are there specific subsystems, security boundaries, or edge cases you want the review panel to focus on?*\n   > 2. *Do you have initial inline feedback or direction where you'd like me to look?*\n   > 3. *Should I give special attention to API \u002F configuration contract compatibility?\"*\n\n---\n\n### Phase 2: Dynamic Expert Subagent Panel & Rule Alignment\n\nOnce the user provides initial directional guidance (or confirms to proceed), the Main Orchestrator dynamically spawns specialized reviewer subagents tailored to the modified file types.\n\n#### Reviewer Inputs & Tool Access\n- Give every reviewer the absolute paths of `pr.diff`, `pr_meta.json`, and `review_threads.json` from `\u003Csession_scratch_dir>`, plus the `head_sha`. Reviewers that only read files can review from these inputs. When `pr_meta.json` has `threads_error`, the thread fetch failed and `review_threads.json` is not authoritative: tell reviewers, and deduplicate against the PR on GitHub instead.\n- Reviewers that must run code (tests, `git log`\u002F`git blame`, builds) need a shell and must work in a worktree at `head_sha`. Do not hand such tasks to read-only reviewers; run the command yourself and pass them the output instead.\n\n#### Hybrid Baseline Rubric + Dynamic Specialist Role Architecture\nTo eliminate **stochastic omission variance** (where dynamic subagents might forget core engineering principles) while retaining deep subsystem expertise, every PR code review enforces a **Hybrid Evaluation Architecture**:\n\n1. **Deterministic Core 8-Pillar Baseline Audit Matrix (`with explicit N\u002FA resolution`)**: Every PR review artifact (`pr_review_audit_checklist.md`) incorporates a deterministic inspection rubric covering:\n   - **Pillar 1: Linear Control Flow & Guard Clauses** (`core_engineering.md#2-kiss`)\n   - **Pillar 2: Single Responsibility Principle & Target Complexity Limit** (`core_engineering.md#1-srp`)\n   - **Pillar 3: Defensive Input Validation & Boundary Checks** (`core_engineering.md`)\n   - **Pillar 4: Concurrency & `context.Context` Propagation Safety** (`golang.md` \u002F `python.md`)\n   - **Pillar 5: Test Double Fidelity & Deterministic Test Execution** (`core_engineering.md#4`)\n   - **Pillar 6: Backward Compatibility & Contract Protection** (`core_engineering.md`)\n   - **Pillar 7: Dependency Graph & Build System Boundaries** (`core_engineering.md`)\n   - **Pillar 8: Documentation & Contract Alignment** (`core_engineering.md#5`)\n   *Crucially, every pillar MUST be evaluated as either an `ACTIONABLE FINDING`, `COMPLIANT \u002F PASS`, or `- [ ] N\u002FA — Subsystem \u002F pattern not touched by PR` with brief rationale, ensuring zero silent omissions.*\n\n2. **Mandatory Subagent**: The review panel MUST always include a dedicated **`PR Description & Task Reference Reconciliation Specialist`**, tasked with evaluating whether the actual git diff matches what the PR title and description claim to do, and verifying that referenced task references, issue links, or design specs are fulfilled.\n3. **Dynamic Domain Subagents (Synthesized by Agent)**: Subagents must NOT concentrate solely on line-by-line code mechanics. When main dependency pillars, workload orchestrators, or scheduling subsystems are touched, the agent should dynamically craft specialized domain expert subagent roles (1–3 roles with tightly scoped prompts). Examples include (but are not limited to):\n   * *Example (Scheduling & Workload Dependency Pillar)*: `Kueue Expert \u002F Subsystem Specialist` auditing `ClusterQueue`, `LocalQueue`, Workunit resource reservation, quota enforcement, preemptor interaction, and Kueue CRD updates whenever scheduling or workload actuation is touched.\n   * *Example (Kubernetes Infrastructure Pillar)*: `Kubernetes (K8s) Expert Specialist` evaluating controller-runtime reconciler loops, informer cache synchronization, RBAC ClusterRole permissions, pod disruption budgets, and GKE lifecycle behavior whenever K8s resources, CRDs, or Helm charts are touched.\n   * *Example (Go Backend)*: `Go Concurrency & Interface Safety Reviewer` checking `context.Context` propagation, mutex boundaries, and test double fidelity (`prototest.Modify`).\n   * *Example (Python Tooling)*: `Python CLI & Shell Injection Security Reviewer` auditing standard library preferences, error handling, and argument escaping.\n   * *Example (UI Frontend)*: `Modern Angular Signal & Immutability Reviewer` verifying declarative template patterns and state immutability.\n   * *Example (Infrastructure \u002F API)*: `Protobuf & Helm Backward-Compatibility Reviewer` verifying breaking schema or deployment changes.\n\n#### Strict Directives for Subagent Prompting\nAll expert subagents invoked during Phase 2 MUST receive the following mandatory guidelines:\n1. **Critical Thinking Required**: Apply genuine engineering critical thinking. Do not output trivial mechanical formatting comments or stylistic preferences.\n2. **\"No Findings\" is a Passable and Respected Result**: Expressly instruct subagents:\n   > *\"Returning 'No actionable findings — code cleanly complies with project rules and guidelines' is a valid, high-value engineering conclusion. Do NOT manufacture artificial issues or exaggerate minor stylistic choices just to return findings.\"*\n3. **PR Description & Requirement Audit**: Verify whether code modifications actually achieve what the author stated in the PR title, description, and referenced task definitions.\n4. **Strict Inline Deduplication & Already-Resolved Thread Governance**:\n   - Inspect the supplied existing comment index (`comments`) and **never generate duplicate inline comments** for problems already raised on the PR.\n   - **Already Resolved Threads on GitHub UI (`[RESOLVED ON GITHUB]`)**: Treat threads marked resolved on GitHub as closed engineering decisions. Do NOT re-open or propose duplicate inline comments unless a new commit explicitly regressed that exact file line.\n5. **Strict Mock & Fixture Isolation Audit**: Explicitly audit production files for mock data leakage. Production components, handlers, and service files must NEVER contain static mock datasets, sample entities, or fallback mock branching. All test doubles and fixtures belong strictly in dedicated test files (`*_test.ts`, `*_test.go`, `test_*.py`) or testing helpers (`cmd\u002Fui\u002Fapp\u002Ftesting\u002Fmock_*.ts`, `test\u002Ffixtures\u002F`) per `core_engineering.md#4`.\n\n---\n\n### Phase 3: Generate Interactive Audit Checklist Artifact (`pr_review_audit_checklist.md`)\n\nAfter subagents complete their reviews, the Main Orchestrator synthesizes findings, filters out duplicate\u002Ftrivial comments, and formats the Interactive Audit Checklist inside `\u003Csession_scratch_dir>\u002Fpr_review_audit_checklist.md`.\n\nCrucially, the Main Orchestrator MUST partition every finding into **two distinct scope categories** based on git diff patch boundaries:\n1. **Group A: Inline PR Diff Patch Items (`Patch-In-Scope`)**: Target lines that were actually modified or added in the PR diff patch. These can be posted directly as inline GitHub diff comments (`tools\u002Fpr_review\u002Freview_pr_post_inline_comment.py`).\n2. **Group B: Out-of-Diff Scope Observations (`Unchanged-Line-Out-of-Scope`)**: Target unchanged surrounding lines in modified files outside the PR diff patch. Because GitHub's inline comment API rejects non-diff lines with 422 errors, these **cannot be posted as inline review comments**.\n\nEach proposed item in `pr_review_audit_checklist.md` must specify:\n* **Item ID** (`#1`, `#2`, ...)\n* **Scope Classification**: `[Group A: Inline Patch]` vs `[Group B: Out-of-Diff Scope]`\n* **Status**: `Draft` (default until user confirms)\n* **File Path & Line Number** (with patch vs unchanged line status clearly flagged)\n* **Rule Reference** (canonical path, e.g., `core_engineering.md#1-single-responsibility-principle` or `pr_review_guidelines.md#1-code-review--inspection-guidelines`)\n* **Priority**: `Blocker` \u002F `Actionable Optimization` \u002F `Clarity Question` \u002F `Nit`\n* **Proposed Inline Comment Text** (with concrete git diff block suggestions where applicable)\n\n#### JSON Sidecar: Source of Truth for Item Status\n`review_pr_verify_posted.py` reads proposed items from `pr_review_audit_checklist.json` (falling back to the markdown only when no sidecar exists) and fails when it finds zero approved items. Keep the markdown for human reading, and record every Group A item in the sidecar's `items` list by rewriting the whole JSON file (never exact-match edits of table cells):\n\n```json\n{\"item_id\": \"#1\", \"type\": \"initial_inline\", \"status\": \"Draft\", \"file_path\": \"pkg\u002Fauth\u002Fhandler.go\", \"line\": 152, \"rule\": \"core_engineering.md#2-kiss\", \"proposed\": \"Use an early guard return.\"}\n```\n\nAfter the Phase 4 confirmation, rewrite confirmed items with `\"status\": \"Approved\"`. Never set `Posted` by hand: use `--mark-posted` (Phase 5) or the verification run (Phase 6).\n\n---\n\n### Phase 4: Mandatory Explicit Confirmation Gate (Zero Unconfirmed or Misleading Posting)\n\n> [!WARNING]\n> **Strict Anti-Jumping & No-Omission Guardrail**: The agent MUST NEVER execute inline comment posting scripts without explicit user confirmation, and MUST NEVER ask an ambiguous question that claims to post `#1 through #8` when items outside the PR diff patch cannot be posted inline.\n\nWhen asking for Phase 4 confirmation, the agent MUST present both tables separately and ask an **explicit partitioned question**:\n\n> *\"I have synthesized our review findings into `pr_review_audit_checklist.md` inside your session folder, partitioned by GitHub PR patch scope:*\n> \n> *### **Group A: Postable Inline PR Diff Patch Comments (Postable Inline)** (4 items)*\n> *| Item | Priority | File & Line | Rule Reference | Summary of Proposed Inline Comment |*\n> *| :--- | :--- | :--- | :--- | :--- |*\n> *| `#1` | Actionable | `pkg\u002Fauth\u002Fhandler.go`:L152 (Patch Line) | `core_engineering.md` | Avoid nested if-else with early guard returns |*\n> *| `#2` | Blocker | `cmd\u002Fxid_service\u002Fmain.go`:L88 (Patch Line) | `core_engineering.md` | Test constructor bypasses nil double |*\n> \n> *### **Group B: Out-of-Diff Scope Observations (Unchanged Lines in Touched Files)** (4 items)*\n> *| Item | Priority | File & Line | Rule Reference | Architectural Observation Summary |*\n> *| :--- | :--- | :--- | :--- | :--- |*\n> *| `#5` | Nit | `pkg\u002Fauth\u002Fhandler.go`:L210 (Unchanged Line) | `core_engineering.md` | Legacy struct field name inconsistency |*\n> *| `#6` | Actionable | `cmd\u002Fxid_service\u002Fmain.go`:L12 (Unchanged Line) | `core_engineering.md` | Dead helper constant outside modified PR diff |*\n> \n> *> [!IMPORTANT]*\n> *> **Posting Scope Clarification**: GitHub's inline review API only supports posting inline comments on changed patch lines (Group A). Group B items cannot be posted inline; by default, they are recorded and tracked exclusively in our session checklist artifact so they do not clutter the PR.*\n> \n> *Please confirm:*\n> *1. **Shall I proceed with posting Group A inline PR comments (#1 through #4) on GitHub?** (`Y`\u002F`n` \u002F modify `#X`)*\n> *2. **Do you want to include any critical Group B out-of-diff items (#5 through #8) as an overall PR summary comment?** (Default is **No** — omit from PR and keep strictly in session checklist artifact unless you explicitly specify critical items to include)*\"\n\n---\n\n### Phase 5: Strictly Inline Posting (`tools\u002Fpr_review\u002Freview_pr_post_inline_comment.py`)\n\nComments MUST always be posted inline on specific PR diff lines. Never post generic PR-level spam unless explicitly requested.\n\nFor each user-approved item:\n1. Write the proposed inline markdown comment to a temporary file (`comment_body.md`). Include the item's sidecar `proposed` text verbatim (e.g. as the first sentence); Phase 6 matches on it.\n2. Run the posting script:\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_post_inline_comment.py \u003Cowner> \u003Crepo> \u003Cpr_number> \\\n       --commit-id \u003Chead_commit_sha> \\\n       --path \u003Cfile_path> \\\n       --line \u003Cline_number> \\\n       -f comment_body.md\n   ```\n3. Record the item as posted (updates the sidecar and the markdown table; no hand edits):\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> \\\n       -c \u003Csession_scratch_dir>\u002Fpr_review_audit_checklist.md --mark-posted '#1'\n   ```\n\n---\n\n### Phase 6: Programmatic 1-to-1 Posted Verification Check\n\nBefore completing the review session:\n1. Execute programmatic verification against the checklist artifact:\n   ```bash\n   python3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> \\\n       -c \u003Csession_scratch_dir>\u002Fpr_review_audit_checklist.md\n   ```\n2. Verify that 100% of approved initial inline review comments appear on the live GitHub PR diff. An item counts only when a comment on its file and line is authored by the authenticated `gh` \u002F `GITHUB_TOKEN` user and contains the item's `proposed` text (whitespace, case, backticks, and asterisks are ignored). A non-zero exit with `No approved items found` means the sidecar was never populated; fix the sidecar instead of editing the markdown.\n3. The tool sets verified items to `Posted` in the sidecar and markdown itself; do not edit statuses by hand.\n\n---\n\n## Mode B: Follow-Up Re-Review & Author Reply Verification Flow\n\nTriggered when reviewing a Pull Request where the author has replied to earlier comments or pushed follow-up commits.\n\n### Phase 1: Pull Author Replies & Diff Deltas\nRun the audit generator script in `re-review` mode at the PR head, with cwd at `\u003Creview_dir>`:\n```bash\npython3 \u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_generate_audit.py \u003Cowner> \u003Crepo> \u003Cpr_number> --mode re-review \\\n    --out-dir \u003Csession_scratch_dir> --checkout\n```\n\n> [!WARNING]\n> On a re-review, `\u003Creview_dir>` is still checked out at the **previous** round's PR head, so its `tools\u002F` are PR-authored. Always use the `\u003Ctrusted_repo>\u002F` path above, never `tools\u002F...` relative to `\u003Creview_dir>` (guideline 7).\n\n*This generates `pr_rereview_audit_report.md` inside `\u003Csession_scratch_dir>` indexing every open review thread, original reviewer text, and author response, plus the sidecar `pr_rereview_audit_report.json` listing each root thread with `\"action\": null`. When recommending an action, rewrite the sidecar with `\"action\": \"RESOLVE\"` or `\"action\": \"RESPOND\"` for that thread; threads left `null` are skipped by verification. It also writes the same review inputs as Mode A (`pr.diff`, `pr_meta.json`, `review_threads.json`) and checks out the PR head under the same dirty-worktree rule.*\n\n*The output's `rereview_delta` (also in `pr_meta.json` and the report header) counts lines changed since the commit of your latest real review (override with `--since-sha`). Pending drafts are ignored, and so are the empty reviews GitHub creates to wrap standalone thread replies, because those are pinned to the head at reply time rather than to reviewed code. Without an earlier review, or when that commit cannot be compared, the size is unknown; after a rebase or force-push it is usually over-counted. Both cases set `full_review_recommended` to `true`.*\n\n> [!IMPORTANT]\n> **Escalate on a large delta**: When `full_review_recommended` is `true` (more than `--full-review-threshold` changed lines, default 200, or unknown), run a full Mode A review on the new head in addition to the thread checks below, and tell the user why. Never limit a re-review to old threads when most of the code is new.\n\n### Phase 2: Evaluate Author Claims, Pushback & Substantial Deltas\n\nFor every discussion thread indexed in the audit report, apply critical engineering evaluation across **4 governance buckets**:\n\n1. **Bucket 1: Already Resolved on GitHub UI (`is_resolved == True`)**:\n   - **Policy**: **Respect & Skip.** Human reviewer explicitly clicked \"Resolve conversation\" on GitHub. List in `pr_rereview_audit_report.md` as `[ALREADY RESOLVED ON GITHUB]` requiring **zero action**.\n2. **Bucket 2: Author Claims \"Applied \u002F Fixed\" on Open Thread**:\n   - Inspect the latest diff delta at that line and file path: `git diff \u003Crereview_delta.since_sha> \u003Chead_sha> -- \u003Cpath>` when `since_sha` is known (run `git -c core.hooksPath=\u002Fdev\u002Fnull fetch \u003Cremote> \u003Csince_sha>` first if it is not local, e.g. after a force-push), else `pr.diff`.\n   - **Verification**: Verify whether the fix was *actually applied cleanly and correctly* or if it introduced edge-case regressions.\n   - **Outcome Classification**:\n     * *Verified Fixed*: Mark `\u003CAudit Verification Status: - [x] Verified Fixed>` and propose Recommended Action: `[RESOLVE]` with justification.\n     * *Claimed Fixed but Flawed\u002FIncomplete*: Mark `\u003CAudit Verification Status: - [ ] Flawed Fix>` and propose Recommended Action: `[RESPOND: \u003Cproposed concrete follow-up diff recommendation>]`.\n3. **Bucket 3: Author Pushes Back \u002F Disagrees on Open Thread**:\n   - Evaluate the author's argument against [Core Engineering Standards](..\u002F..\u002Frules\u002Fcore_engineering.md) and security principles.\n   - **Outcome Classification**:\n     * *Pushback is Valid*: Propose Recommended Action: `[RESOLVE]` acknowledging the author's design trade-off.\n     * *Pushback is Invalid \u002F Missing Context*: Propose Recommended Action: `[RESPOND: \u003Ctechnical rationale & reference to rules>]`.\n4. **Bucket 4: Substantial Code Delta Pushed**:\n   - If the author refactored major modules or added new code to address comments (see `rereview_delta.changed_files`), spawn a dedicated delta review subagent on the newly modified code. Above the threshold, escalate to the full Mode A review described in Phase 1.\n\n### Phase 3: Structured Markdown Iteration Report (`pr_rereview_audit_report.md`)\n\nPresent all thread verification findings inside `\u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md` with explicit action proposals:\n\n````markdown\n### Thread ID `101` (`pkg\u002Fauth\u002Fhandler.go`:L152)\n- **Original Reviewer**: *Avoid nested if-else*\n- **Author Reply**: *\"Applied early guard returns in commit abc1234\"*\n- **Audit Verification Outcome**: **Verified Applied** (Line 152 now uses clean linear guard clauses per `core_engineering.md`).\n- **Proposed Action**: `[RESOLVE]`\n\n---\n\n### Thread ID `102` (`cmd\u002Fxid_service\u002Fmain.go`:L88)\n- **Original Reviewer**: *Test double bypasses nil dependency*\n- **Author Reply**: *\"Pushing back: nil mock is sufficient for unit test\"*\n- **Audit Verification Outcome**: **Pushback Invalid** (Per `core_engineering.md#4`, test constructors must provide high-fidelity doubles; nil silently disables metric Recorders).\n- **Proposed Action**: `[RESPOND]`\n- **Proposed Counter-Reply**:\n  ```markdown\n  While a nil mock avoids compile errors, `GatewayMetrics` recording silently drops metric counters during unit tests (see `core_engineering.md#4`). Please inject `NewTestMetricsRecorder()` so test assertions can verify telemetry recording.\n  ```\n````\n\n#### Asynchronous User Markdown Iteration Loop\nBecause the re-review analysis is saved as a markdown document in `\u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md`, **you can edit this file directly in your workspace**—changing proposed actions from `[RESPOND]` to `[RESOLVE]` or tuning counter-reply text—so the agent iterates asynchronously without losing thread state.\n\n### Phase 4: Explicit Confirmation Gate & Batch Action Execution\n* The agent asks for explicit confirmation:\n  > *\"Please inspect `pr_rereview_audit_report.md`. Shall I proceed with posting recommended counter-replies and resolving verified threads on PR #\u003Cpr_number>? (Y\u002Fn)\"*\n* For every confirmed thread:\n  * If `[RESPOND]`: Invoke `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_post_inline_comment.py \u003Cowner> \u003Crepo> \u003Cpr_number> --in-reply-to \u003Cthread_id> -f counter_reply.md`.\n  * If `[RESOLVE]`: Invoke `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_post_inline_comment.py \u003Cowner> \u003Crepo> \u003Cpr_number> --resolve-thread \u003Cthread_id>` to resolve verified threads programmatically via GitHub GraphQL. To inspect current thread state (thread IDs, `path:line`, resolution, whether you replied), run `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_threads.py list \u003Cowner> \u003Crepo> \u003Cpr_number>`; never hand-write `gh api graphql` calls.\n* After resolving a thread, record it with `\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> -c \u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md --mark-posted \u003Cthread_id>`.\n* Run programmatic verification check (`\u003Ctrusted_repo>\u002Ftools\u002Fpr_review\u002Freview_pr_verify_posted.py \u003Cowner> \u003Crepo> \u003Cpr_number> -c \u003Csession_scratch_dir>\u002Fpr_rereview_audit_report.md`). A `RESPOND` thread passes only when the authenticated user replied to it. A `RESOLVE` thread passes only when GitHub reports it resolved; a reply, a `Posted` status, or a `[x]` marker alone is not sufficient.\n",{"name":5,"description":7},"main","1f7f860b618a010ba54e6577bb4647643d06020e",".agents\u002Fskills\u002Fxmc_review_pr",0,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 11:47:55",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add google\u002Fxmc --skill \"XMC Review PR\"",{"tool":58,"command":59},"bunx","bunx skills add google\u002Fxmc --skill \"XMC Review PR\"",{"tool":61,"command":62},"pnpm","pnpm dlx skills add google\u002Fxmc --skill \"XMC Review PR\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_review_pr\u002FSKILL.md",true,[],[67,86,108,131,154,173],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":38},"01M6X0PXHKB5KRZ6BESP7J4A3H","XMC Upgrade Environment","Upgrades an existing XManager on Cloud (XMC) environment on GKE to the latest current branch state using the deployment configuration YAML.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_upgrade\u002FSKILL.md",[],[74,69,75,76,77,78,79,80,81,82,83,84,85],"environment","upgrade","branch","deployment","upgrades","Existing","state","gke","yaml","latest","cloud","configuration",{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":38},"01M6X0PQ36XYVZW78KRBR8MT9E","XMC Trajectory Comparison","Validates proposed skill or rule changes by executing concurrent A\u002FB benchmark subagents on clean baseline vs candidate worktrees, comparing trajectories, and tearing down test resources.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_trajectory_comparison\u002FSKILL.md",[],[88,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107],"comparison","trajectory","resources","down","clean","trajectories","candidate","test","changes","worktrees","baseline","benchmark","clean baseline","rule","subagents",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":38},"01M6X0P8K827HRQFZS32Y1KB2N","XMC Release","Orchestrates an end-to-end XMC release workflow — deploying the latest main to nightly, running and verifying e2e tests, capturing visual snapshot galleries, generating and iterating on structured release notes with the user, and publishing the release. Use when preparing, orchestrating, or publishing a formal XMC release from main.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_release\u002FSKILL.md",[],[110,115,116,117,118,119,43,120,121,122,123,31,124,125,126,127,83,128,129,130],"release","running","end","tests","publishing","e2e","release notes","use","when","visual","with","notes","e2e tests","snapshot","user","structured",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":38},"01M6X0P20VKAAEP4R43HJQ9957","XMC PR Split Verification","Analyzes pull request diffs exceeding size thresholds (400 prod \u002F 1000 total \u002F 1000 docs) to enforce Single Responsibility Principle (SRP), evaluate vertical slice splitting feasibility, eliminate dead code, and plan gh-stack PR stacks.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_pr_split_verification\u002FSKILL.md",[],[20,133,138,29,139,140,141,142,143,144,145,30,146,147,148,149,150,151,152,153],"split","pull","thresholds","slice","enforce","diffs","single","gh","vertical slice","stack","plan","size","evaluate","pull request","request","dead code",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":160,"publishedAt":38},"01M6X0NV5ZP3T8RPKRYGGJ613G","XMC Iterative Reflection","Audits active session trajectory, thought history, and PR review comments to identify friction points, rule gaps, missing helper tools, and token inefficiencies. Use when requested by the user, after major implementations, or following PR review comment resolutions.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_iterative_reflection\u002FSKILL.md",[],[156,161,162,123,19,163,164,165,166,20,25,167,168,122,169,170,171,94,172,106],"reflection","pr review comments","active","token","Tools","history","session","missing","helper","comments","gaps","friction",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":38},"01M6X0NNRV5MK72RNAQZ8EHPMD","XMC Generate Release Notes","Generates structured, intelligent release notes segmented into out-of-the-box user-facing changes, behind-the-flag preview features, and operational\u002Fdev progress.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_generate_release_notes\u002FSKILL.md",[],[175,121,126,180,115,181,182,101,183,184,185,129,130],"generate","dev","preview","progress","features","box"]