Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions skills/pr-merge-tracker/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,30 @@ Group PRs into:

Start with a metadata baseline: tiny metadata-only diffs 95-98; small tested fixes 85-94; bigger, novel, or infrastructure changes 75-84. Missing required approval caps the score around 70, conflicts around 45-72, and drafts around 40-60. These are subjective confidence scores, not probabilities or substitutes for merge requirements.

Fetch the diff for an initial review:
Collect diffs with the bundled collector, not `gh pr diff`, the pulls/files API, or the compare API's `files`. Those cap at 300 files or 20,000 lines and silently turn large reviews into samples:

```bash
gh pr diff <number> -R "$repo" --patch
python3 <skill-dir>/scripts/collect_diffs.py collect -R "$repo" --out "$run/diffs" <numbers...>
```

It resolves each PR's merge base and head through the API, fetches them into a blob-filtered bare cache (`~/.agents/state/pr-merge-tracker/git/`), and writes `<n>/net.patch`, `<n>/inventory.txt`, `<n>/manifest.json` and `<n>/chunks/NNN.patch` (80,000 characters each, with hunks split, never truncated). If the caller keeps a state file whose `prs.<number>.reviewedHeadSha` records the last reviewed head, pass it with `--state`. Unchanged heads then get no chunks, and `delta` chunks hold only files whose own +/- lines changed, so main-only churn drops out. A nonzero exit or any `errors` or `inventoryMismatch` entry means that PR has no complete diff; report it as such and do not label it reviewed.

Chunk kinds: `required` (code, config, tests, docs, and any file whose diff touches an `export`), `mechanical` (only import/require specifier or blank-line changes), `generated` (lockfiles, snapshots, fixtures, generated or binary files). Rename-only files appear only in the inventory. Read every `required` chunk. Spot-check `mechanical` and `generated` chunks against the inventory, and do not count them as read code. When one reviewer cannot read every required chunk of a PR, split that PR's chunks across reviewers, then merge the verdicts.

Each reviewer returns the chunk IDs it actually read. Compute the review depth; never write it by hand:

```bash
python3 <skill-dir>/scripts/collect_diffs.py depth "$run/diffs/<n>/manifest.json" --read 001 002 ...
```

The label is `full (...)` only when every required chunk was read and the inventory matches GitHub's file count. Otherwise it reads `sampled N%`. A reviewer's `sampled` flag or a listed limitation always wins over a summary method string. Never upgrade one to `full`. For diffs too large to read in full, read every `config` and export-touching file and a sample of the rest, keep the computed `sampled N%` label, and lower the score unless the unread part is shown to be mechanical.

Check for breaking changes, removed exports still referenced, API changes, migrations, authentication and billing risks, performance-sensitive paths, caching, sensitive values in logs, and test coverage for behavior changes. Read the repository's own guidance for project-specific constraints. Lower the score for concrete risks and include the review verdict in the rationale.

Only repeat the diff review for new PRs or changed `headRefOid` values. Reuse unchanged diff verdicts, but refresh CI, reviews, merge state, and the resulting score every run. If the diff is unavailable, label the score metadata-only and explain the limitation.
Only repeat the diff review for new PRs or changed `headRefOid` values. Reuse unchanged diff verdicts, but refresh CI, reviews, merge state, and the resulting score every run. If the diff is unavailable, label the score metadata-only and explain the limitation. Do not claim tests were run because test files or CI results exist.

## Report

Return a ranked list with one bullet per PR: score, readiness group, one-line rationale, and a Markdown link using the PR's returned `url`. Flag newly merged or closed PRs and new PRs since the previous run. Verify the state of previously tracked PRs before calling them merged or closed; disappearance from the list alone is not sufficient.
Return a ranked list with one bullet per PR: score, readiness group, one-line rationale, `sampled N%` when the review was not full, and a Markdown link using the PR's returned `url`. Give the full and sampled counts in the summary line. Flag newly merged or closed PRs and new PRs since the previous run. Verify the state of previously tracked PRs before calling them merged or closed; disappearance from the list alone is not sufficient.

Report once per invocation. If a recurring monitor invokes this skill, follow its configured notification policy and cadence.
Loading
Loading