hud-gateway
How much of your team's time goes to approving agent PRs that were already fine, and the approvals
policy that hands it back.
npx hud-gateway # the repo behind `origin` in this folder
npx hud-gateway owner/repo
npx hud-gateway --days 90 # 30 days by default; it widens to 90 and 180 on its own when 30 days hold fewer than 25 agent PRs
npx hud-gateway --sample # an invented repo, no token: for demos and recordings
npx hud-gateway --json hud-gateway.json # keep the run
npx hud-gateway --replay hud-gateway.json --policy hud-gateway.yml # replay an edited policy, no GitHub calls
After a run saved with --json, edit hud-gateway.yml by hand (or let your coding agent do it) and
--replay it: the PRs are already in the saved run, so it takes a second, prints how many PRs move, and
prints a fresh editor link carrying the edited policy. Output has no colour when piped, so agents read it plainly.
The link. The editor opens from a link that carries the policy inside it; nothing is uploaded. On a
small repo it carries every agent PR, so edits replay in the browser at once. On a large repo that would
be tens of KB, so the link carries the rules, the numbers and five examples a side instead (2 to 3 KB,
whatever the repo), and the editor's "Load the run file" reads the --json file from your disk to show
every PR and replay edits live. Your own browser is always opened with the full data.
Using a coding agent? Paste this and it does the rest, from the run to the setup PR:
Set up Hud Merge Gateway for this repo. Follow https://play.hudx.io/skills/hud-merge-gateway/SKILL.md
To keep the skill installed: npx skills add https://play.hudx.io/skills/hud-merge-gateway/SKILL.md.
Agents without skills can follow https://play.hudx.io/docs/merge-gateway/setup.md.
In a pnpm workspace (dependencies on catalog: or workspace:), npx can fail with
Unsupported URL Type "catalog:": npm tries to read the pnpm tree. Use pnpm dlx hud-gateway, or run
npx hud-gateway owner/repo from outside the repo.
Read-only and zero dependencies. It uses your gh login (its token, read once) or GITHUB_TOKEN with
read access to Contents, Pull requests and Metadata. It lists merged PRs 100 a request, then reads reviews and files
only for the PRs that need them (agent-written, and fix PRs), 25 a request with four in flight, so a
30-day window of a busy repo takes seconds; --rest reads over the REST API instead. The policy is written
to hud-gateway.yml next to you, and the result opens in the Hud editor at play.hudx.io/gateway, carried
inside the link itself: nothing is uploaded.
Flags: --days 30, --max 500 (it stops at the newest 500 merged PRs even when that covers less than 30 days, and reports the days it covered), --out hud-gateway.yml, --json out.json, --payload out.json, --pr-body file (a ready description for the setup PR: the time lost first, then the editor link), --no-open, --open (open the browser even when output is piped), --quiet, --rest, --replay run.json with --policy hud-gateway.yml.
The three beats before the policy:
- Hours waited for approvals that changed nothing. A rubber stamp is a human approval with no
review comment, no change request and no commit after it. The wait runs from the moment the PR was
final (last push or ready-for-review) to that approval.
- Did they hold up? Of the PRs that merged with a rubber stamp or no human review, old enough to
judge, how many were not reverted or rewritten within 14 days. Rewritten means a later PR that reads
like a fix and names the PR or touches at least half of its non-test files. Reverts are PRs with
"revert" in the title that point at it. No production signal is used.
- Reviewer time. 20 minutes of attention per rubber stamp.
Then the draft: rules from the repository tree, CODEOWNERS, branch rules and the AI reviewers already
on the PRs, replayed deterministically on the agent-written PRs. No model call anywhere.
Source: https://github.com/code-hud/play-hud/tree/main/packages/hud-gateway