agents: add gh_pr_stack helper and clarify PR comment disclosures (#4519)

Unreviewed agent comments previously used inconsistent disclosure
wording, and stacked PR creation had no shared helper or rule
distinguishing same-repo from forked-repo stacks.

Add `.agents/scripts/gh_pr_stack.py` (with unit tests) to manage native
GitHub PR stacks via the `/stacks` REST API, document same-repo vs.
forked-repo stacking and PR-only issue references in
`.agents/rules/pr.md`, and standardize unreviewed comment disclosures on
`*This is an agent-generated comment unreviewed by the user.*`.
diff --git a/.agents/rules/pr.md b/.agents/rules/pr.md
index e583c8e..c3815f7 100644
--- a/.agents/rules/pr.md
+++ b/.agents/rules/pr.md
@@ -53,7 +53,17 @@
   run or narrate build IDs, commit SHAs, line counts, or trivial diff details
   (e.g., "comment-only"); comment `PTAL` only when ready for re-review.
 * High-level overview only: state *why* the change is made and *how* at a
-  conceptual level. Link related issues (e.g. `Work towards #<issue>`).
+  conceptual level.
+* **Issue References**: Reference issues in PR descriptions (e.g., `Work towards
+  #<issue>`), never in commit messages; rebasing commits with `#<issue>` spams
+  the issue.
+* **Stacked Pull Requests**:
+  * **Same-repo** (head and base branches both in `rules_python`): Base each
+    child PR on its parent branch (`--base <parent-branch>`), register the PRs
+    in GitHub's native PR stack via `.agents/scripts/gh_pr_stack.py` (`create` /
+    `add`), and omit stack headers or tables from the PR description.
+  * **Forked-repo** (head branch in a fork, base branch in `rules_python`):
+    Add `DO NOT MERGE: awaiting #<parent_pr>` to child PR descriptions.
 * **Conciseness & Style (Strunk & White)**: Omit needless words. Use clear,
   active, and direct phrasing for *why* and *how*.
 * **Benchmark Summaries**: Format performance comparisons as a brief 3-5 bullet
@@ -74,8 +84,8 @@
 * End every posted PR comment or review reply with an italicized disclosure
   line:
   * If the exact comment text was not shown to and approved by the user before
-    posting (including automatic PR AI disclosure comments):
-    `*This is an automatically generated agent comment.*`
+    posting (including automatic PR disclosures and direct review replies):
+    `*This is an agent-generated comment unreviewed by the user.*`
   * Only if the user was shown the exact comment text and explicitly approved
     posting it:
     `*This is an agent-generated comment reviewed and approved by the user.*`
diff --git a/.agents/scripts/BUILD.bazel b/.agents/scripts/BUILD.bazel
new file mode 100644
index 0000000..0b55235
--- /dev/null
+++ b/.agents/scripts/BUILD.bazel
@@ -0,0 +1,18 @@
+load("//python:py_library.bzl", "py_library")
+load("//python:py_test.bzl", "py_test")
+
+package(default_visibility = ["//visibility:private"])
+
+py_library(
+    name = "gh_pr_stack",
+    testonly = True,
+    srcs = ["gh_pr_stack.py"],
+    imports = ["."],
+)
+
+py_test(
+    name = "gh_pr_stack_test",
+    size = "small",
+    srcs = ["gh_pr_stack_test.py"],
+    deps = [":gh_pr_stack"],
+)
diff --git a/.agents/scripts/gh_pr_stack.py b/.agents/scripts/gh_pr_stack.py
new file mode 100755
index 0000000..487a35f
--- /dev/null
+++ b/.agents/scripts/gh_pr_stack.py
@@ -0,0 +1,216 @@
+#!/usr/bin/env python3
+"""Manage native GitHub pull request stacks via the GitHub REST API.
+
+Usage:
+  .agents/scripts/gh_pr_stack.py create <pr1> <pr2> [<prN>...] [--repo <owner/name>]
+  .agents/scripts/gh_pr_stack.py add <stack_number> <pr1> [<prN>...] [--repo <owner/name>]
+  .agents/scripts/gh_pr_stack.py unstack <stack_number> <pr1> [<prN>...] [--repo <owner/name>]
+  .agents/scripts/gh_pr_stack.py show <stack_number> [--repo <owner/name>]
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import subprocess
+import sys
+from collections.abc import Sequence
+
+_DEFAULT_REPO = "bazel-contrib/rules_python"
+_ACCEPT_HEADER = "Accept: application/vnd.github+json"
+_REPO_SLUG_RE = re.compile(r"^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+\Z")
+
+
+def build_parser() -> argparse.ArgumentParser:
+    """Builds the CLI argument parser.
+
+    Returns:
+        Configured `argparse.ArgumentParser` for `gh_pr_stack`.
+    """
+    parser = argparse.ArgumentParser(
+        description="Manage native GitHub pull request stacks."
+    )
+    subparsers = parser.add_subparsers(dest="command", required=True)
+
+    create_parser = subparsers.add_parser(
+        "create", help="Create a new stack with two or more PR numbers"
+    )
+    create_parser.add_argument(
+        "prs", type=int, nargs="+", help="PR numbers to include in the stack"
+    )
+    create_parser.add_argument("--repo", default=_DEFAULT_REPO, help="Owner/repo slug")
+
+    add_parser = subparsers.add_parser(
+        "add", help="Add one or more PR numbers to an existing stack"
+    )
+    add_parser.add_argument("stack_number", type=int, help="Stack number")
+    add_parser.add_argument("prs", type=int, nargs="+", help="PR numbers to add")
+    add_parser.add_argument("--repo", default=_DEFAULT_REPO, help="Owner/repo slug")
+
+    unstack_parser = subparsers.add_parser(
+        "unstack", help="Remove one or more PR numbers from an existing stack"
+    )
+    unstack_parser.add_argument("stack_number", type=int, help="Stack number")
+    unstack_parser.add_argument("prs", type=int, nargs="+", help="PR numbers to remove")
+    unstack_parser.add_argument("--repo", default=_DEFAULT_REPO, help="Owner/repo slug")
+
+    show_parser = subparsers.add_parser("show", help="Display an existing stack")
+    show_parser.add_argument("stack_number", type=int, help="Stack number")
+    show_parser.add_argument("--repo", default=_DEFAULT_REPO, help="Owner/repo slug")
+
+    return parser
+
+
+def validate_repo_slug(repo: str) -> str:
+    """Validates an `owner/name` repository slug fail-closed.
+
+    Args:
+        repo: Repository slug in `owner/name` format.
+
+    Returns:
+        The validated `owner/name` slug.
+    """
+    if not _REPO_SLUG_RE.match(repo):
+        raise ValueError(f"Invalid repository slug: {repo!r}")
+    owner, name = repo.split("/", 1)
+    if (
+        owner in {".", ".."}
+        or name in {".", ".."}
+        or owner.startswith("-")
+        or name.startswith("-")
+    ):
+        raise ValueError(f"Invalid repository slug: {repo!r}")
+    return repo
+
+
+def run_gh_api(args: Sequence[str]) -> dict:
+    """Runs `gh api` with the given arguments and parses the JSON response.
+
+    Args:
+        args: Arguments forwarded to `gh api` after the `Accept` header.
+
+    Returns:
+        Parsed JSON object returned by the GitHub REST API.
+    """
+    result = subprocess.run(
+        ["gh", "api", "-H", _ACCEPT_HEADER, *args],
+        capture_output=True,
+        text=True,
+        check=True,
+    )
+    return json.loads(result.stdout or "{}")
+
+
+def create_stack(repo: str, pull_requests: Sequence[int]) -> dict:
+    """Creates a new GitHub PR stack containing `pull_requests`.
+
+    Args:
+        repo: Repository slug in `owner/name` format.
+        pull_requests: Pull request numbers (at least two) in stack order.
+
+    Returns:
+        Created stack metadata dict from GitHub REST API.
+    """
+    if len(pull_requests) < 2:
+        raise ValueError("Creating a stack requires at least 2 pull request numbers")
+    slug = validate_repo_slug(repo)
+    fields = [f"-F=pull_requests[]={pr}" for pr in pull_requests]
+    return run_gh_api(["-X", "POST", f"repos/{slug}/stacks", *fields])
+
+
+def add_to_stack(repo: str, stack_number: int, pull_requests: Sequence[int]) -> dict:
+    """Adds `pull_requests` to an existing GitHub PR stack.
+
+    Args:
+        repo: Repository slug in `owner/name` format.
+        stack_number: Existing GitHub stack number.
+        pull_requests: Pull request numbers to append to the stack.
+
+    Returns:
+        Updated stack metadata dict from GitHub REST API.
+    """
+    slug = validate_repo_slug(repo)
+    fields = [f"-F=pull_requests[]={pr}" for pr in pull_requests]
+    return run_gh_api(
+        ["-X", "POST", f"repos/{slug}/stacks/{stack_number}/add", *fields]
+    )
+
+
+def unstack_prs(repo: str, stack_number: int, pull_requests: Sequence[int]) -> dict:
+    """Removes `pull_requests` from an existing GitHub PR stack.
+
+    Args:
+        repo: Repository slug in `owner/name` format.
+        stack_number: Existing GitHub stack number.
+        pull_requests: Pull request numbers to remove from the stack.
+
+    Returns:
+        Updated stack metadata dict from GitHub REST API.
+    """
+    slug = validate_repo_slug(repo)
+    fields = [f"-F=pull_requests[]={pr}" for pr in pull_requests]
+    return run_gh_api(
+        ["-X", "POST", f"repos/{slug}/stacks/{stack_number}/unstack", *fields]
+    )
+
+
+def show_stack(repo: str, stack_number: int) -> dict:
+    """Fetches metadata and pull request membership for a GitHub PR stack.
+
+    Args:
+        repo: Repository slug in `owner/name` format.
+        stack_number: Existing GitHub stack number.
+
+    Returns:
+        Stack metadata dict from GitHub REST API.
+    """
+    slug = validate_repo_slug(repo)
+    return run_gh_api([f"repos/{slug}/stacks/{stack_number}"])
+
+
+def format_stack(data: dict) -> str:
+    """Formats stack JSON data as a human-readable summary.
+
+    Args:
+        data: Stack metadata dict returned by the GitHub `/stacks` API.
+
+    Returns:
+        Multi-line summary string listing the stack header and each PR.
+    """
+    lines = [f"stack #{data['number']} base={data['base']['ref']} open={data['open']}"]
+    for pr in data.get("pull_requests", []):
+        lines.append(
+            f"  #{pr['number']} {pr['head']['ref']} -> {pr['base']['ref']} "
+            f"draft={pr['draft']} state={pr['state']}"
+        )
+    return "\n".join(lines)
+
+
+def main(argv: Sequence[str] | None = None) -> int:
+    """CLI entrypoint.
+
+    Args:
+        argv: Command-line arguments (excluding `sys.argv[0]`), or `None` to use
+            `sys.argv[1:]`.
+
+    Returns:
+        Process exit code (`0` on success).
+    """
+    args = build_parser().parse_args(argv)
+    if args.command == "create":
+        data = create_stack(args.repo, args.prs)
+    elif args.command == "add":
+        data = add_to_stack(args.repo, args.stack_number, args.prs)
+    elif args.command == "unstack":
+        data = unstack_prs(args.repo, args.stack_number, args.prs)
+    elif args.command == "show":
+        data = show_stack(args.repo, args.stack_number)
+    else:
+        raise ValueError(f"Unsupported command: {args.command!r}")
+    print(format_stack(data))
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/.agents/scripts/gh_pr_stack_test.py b/.agents/scripts/gh_pr_stack_test.py
new file mode 100644
index 0000000..c0d3ca5
--- /dev/null
+++ b/.agents/scripts/gh_pr_stack_test.py
@@ -0,0 +1,145 @@
+#!/usr/bin/env python3
+"""Unit tests for gh_pr_stack.py."""
+
+from __future__ import annotations
+
+import subprocess
+import unittest
+from unittest import mock
+
+import gh_pr_stack
+
+_SAMPLE_STACK_JSON = """{
+  "number": 4513,
+  "open": true,
+  "base": {"ref": "main"},
+  "pull_requests": [
+    {
+      "number": 4511,
+      "draft": true,
+      "state": "open",
+      "head": {"ref": "rickeylev/shrubbery/01-py-wheel-dist"},
+      "base": {"ref": "main"}
+    },
+    {
+      "number": 4512,
+      "draft": true,
+      "state": "open",
+      "head": {"ref": "rickeylev/shrubbery/02-py-console-script-gen"},
+      "base": {"ref": "rickeylev/shrubbery/01-py-wheel-dist"}
+    }
+  ]
+}"""
+
+
+class GhPrStackTest(unittest.TestCase):
+    def test_validate_repo_slug_accepts_valid_slug(self) -> None:
+        self.assertEqual(
+            gh_pr_stack.validate_repo_slug("bazel-contrib/rules_python"),
+            "bazel-contrib/rules_python",
+        )
+
+    def test_validate_repo_slug_rejects_traversal_and_flags(self) -> None:
+        for invalid in (
+            "../foo",
+            "owner/..",
+            "-flag/repo",
+            "owner/-repo",
+            "bad",
+            "owner/repo\n",
+        ):
+            with self.subTest(invalid=invalid):
+                with self.assertRaises(ValueError):
+                    gh_pr_stack.validate_repo_slug(invalid)
+
+    @mock.patch.object(subprocess, "run", autospec=True)
+    def test_create_invokes_gh_api(self, mock_run: mock.MagicMock) -> None:
+        mock_run.return_value = subprocess.CompletedProcess(
+            args=[], returncode=0, stdout=_SAMPLE_STACK_JSON, stderr=""
+        )
+        rc = gh_pr_stack.main(["create", "4511", "4512"])
+        self.assertEqual(rc, 0)
+        mock_run.assert_called_once_with(
+            [
+                "gh",
+                "api",
+                "-H",
+                "Accept: application/vnd.github+json",
+                "-X",
+                "POST",
+                "repos/bazel-contrib/rules_python/stacks",
+                "-F=pull_requests[]=4511",
+                "-F=pull_requests[]=4512",
+            ],
+            capture_output=True,
+            text=True,
+            check=True,
+        )
+
+    def test_create_requires_at_least_two_prs(self) -> None:
+        with self.assertRaises(ValueError):
+            gh_pr_stack.main(["create", "4511"])
+
+    @mock.patch.object(subprocess, "run", autospec=True)
+    def test_add_invokes_add_endpoint(self, mock_run: mock.MagicMock) -> None:
+        mock_run.return_value = subprocess.CompletedProcess(
+            args=[], returncode=0, stdout=_SAMPLE_STACK_JSON, stderr=""
+        )
+        rc = gh_pr_stack.main(["add", "4513", "4514", "4515"])
+        self.assertEqual(rc, 0)
+        mock_run.assert_called_once_with(
+            [
+                "gh",
+                "api",
+                "-H",
+                "Accept: application/vnd.github+json",
+                "-X",
+                "POST",
+                "repos/bazel-contrib/rules_python/stacks/4513/add",
+                "-F=pull_requests[]=4514",
+                "-F=pull_requests[]=4515",
+            ],
+            capture_output=True,
+            text=True,
+            check=True,
+        )
+
+    @mock.patch.object(subprocess, "run", autospec=True)
+    def test_unstack_invokes_unstack_endpoint(self, mock_run: mock.MagicMock) -> None:
+        mock_run.return_value = subprocess.CompletedProcess(
+            args=[], returncode=0, stdout=_SAMPLE_STACK_JSON, stderr=""
+        )
+        rc = gh_pr_stack.main(["unstack", "4513", "4515"])
+        self.assertEqual(rc, 0)
+        mock_run.assert_called_once_with(
+            [
+                "gh",
+                "api",
+                "-H",
+                "Accept: application/vnd.github+json",
+                "-X",
+                "POST",
+                "repos/bazel-contrib/rules_python/stacks/4513/unstack",
+                "-F=pull_requests[]=4515",
+            ],
+            capture_output=True,
+            text=True,
+            check=True,
+        )
+
+    @mock.patch.object(subprocess, "run", autospec=True)
+    def test_show_formats_summary(self, mock_run: mock.MagicMock) -> None:
+        mock_run.return_value = subprocess.CompletedProcess(
+            args=[], returncode=0, stdout=_SAMPLE_STACK_JSON, stderr=""
+        )
+        data = gh_pr_stack.show_stack("bazel-contrib/rules_python", 4513)
+        self.assertEqual(
+            gh_pr_stack.format_stack(data),
+            "stack #4513 base=main open=True\n"
+            "  #4511 rickeylev/shrubbery/01-py-wheel-dist -> main draft=True state=open\n"
+            "  #4512 rickeylev/shrubbery/02-py-console-script-gen -> rickeylev/shrubbery/01-py-wheel-dist draft=True state=open",
+        )
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/.agents/skills/create-pr/SKILL.md b/.agents/skills/create-pr/SKILL.md
index af25932..5685610 100644
--- a/.agents/skills/create-pr/SKILL.md
+++ b/.agents/skills/create-pr/SKILL.md
@@ -24,7 +24,7 @@
      the PR) the AI disclosure comment explaining how PR comments will be
      handled. When posted automatically during `create pr` without prior user
      review of the comment text, end it with:
-     `*This is an automatically generated agent comment.*`
+     `*This is an agent-generated comment unreviewed by the user.*`
      Only use `*This is an agent-generated comment reviewed and approved by the
      user.*` if the user previously reviewed `pr_info.md` and approved the
      draft text.
diff --git a/.agents/skills/review-code/SKILL.md b/.agents/skills/review-code/SKILL.md
index dd488b8..30fa6ca 100644
--- a/.agents/skills/review-code/SKILL.md
+++ b/.agents/skills/review-code/SKILL.md
@@ -243,8 +243,8 @@
   at the end of each comment:
   `*This is an agent-generated comment reviewed and approved by the user.*` if
   the user reviewed and approved posting the comment, or
-  `*This is an automatically generated agent comment.*` if posted without user
-  review.
+  `*This is an agent-generated comment unreviewed by the user.*` if posted
+  without user review.
 
 ### Synthesis & Anti-Noise Gate (Guardrails)