ghwh 0.2.0

GitHub webhook events (PRs, issues, comments, reviews, CI, pushes) as JSON lines, for agents and scripts
ghwh-0.2.0 is not a library.

ghwh: GitHub webhooks for agents

GitHub events (PRs, issues, comments, reviews, CI results, pushes) reach your agents and scripts within seconds, on any machine, with no open port. That includes laptops behind NAT, headless VPSes and a whole swarm of them at once.

GitHub ──webhook──▶ your hub (Cloudflare Worker + Durable Object) ──▶ ghwh tail / ghwh wait   (WebSocket)
                       signature check, last 1000 events, seq          └▶ any MCP client        (POST /mcp)
  • You run your own hub. It's a small Worker on your Cloudflare account; the free plan is enough. There is no shared service and no default domain. bunx ghwh setup deploys it and hooks your repos.
  • Every client reads the same ordered log. Each event has an increasing seq. Clients resume from their last seq after a restart or disconnect, so nothing is missed. The hub keeps the last 1000 events.
  • For agents. Clients can be a CLI that prints JSON lines (tail for streaming tools, wait for agents that can only run a command and read the result), an MCP endpoint (wait_events long-polls), or the raw WebSocket.
  • Private by default. Without the stream key you get nothing. Optionally, the hub can serve public repos' events without a key.

Quick start

bunx ghwh setup          # or: npx ghwh setup

The wizard checks every step and offers fixes until events actually arrive:

  1. Cloudflare login: in the browser, or with a pasted API token on servers without one.
  2. Deploy: the Worker, on *.workers.dev or on your own domain (hooks.example.com).
  3. Secrets: it generates the webhook secret and the stream key and stores them in ~/.config/ghwh/config.json (0600).
  4. Hooks: it adds webhooks to the repos or orgs you name (through gh), pings each one, and waits until the ping reaches the hub.

Then:

ghwh tail --text                                   # watch events live
ghwh wait --state ~/.ghwh/my-agent -t 600          # block until the next event; exit 124 on timeout
ghwh list --kind check --limit 5                   # recent CI results

Install the CLI with npm i -g ghwh or bun add -g ghwh, which pull in a prebuilt binary, or with cargo install ghwh. Other machines only need bunx ghwh setup --connect https://hooks.example.com and the stream key.

Use it from agents

Agent can… Use
run a command and react to each output line (Claude Code's Monitor tool, tail -f-style tools) ghwh tail --repo owner/name
only run a command and read its result (pi, simple tool loops, cron) ghwh wait --state FILE -t 600 in a loop
speak MCP https://<hub>/mcp, tools wait_events and list_events
anything else the WebSocket at wss://<hub>/github/stream (protocol)
# Claude Code: add the hub as an MCP server
claude mcp add --transport http ghwh https://hooks.example.com/mcp \
  --header "Authorization: Bearer $(node -p 'require(process.env.HOME+"/.config/ghwh/config.json").key')"

More, including prompts that work: docs/agents.md.

Events

Every event has seq, kind, action, repo, private and sender, plus fields for its kind:

kind actions from GitHub event
pr opened, reopened, ready_for_review, converted_to_draft, closed, synchronize, labeled, unlabeled pull_request
issue opened, reopened, closed, labeled, unlabeled issues
comment created issue_comment, pull_request_review_comment
review submitted pull_request_review
check completed check_suite, workflow_run
push pushed (default branch only) push
ping ping ping (when a hook is created or pinged)
{"seq":42,"kind":"check","action":"completed","repo":"acme/app","private":false,"sender":"alice","source":"workflow_run",
 "name":"CI","conclusion":"failure","branch":"fix-login","sha":"9f2c…","prs":[17],"url":"https://github.com/acme/app/actions/runs/…","author":"alice","trigger":"pull_request"}

Field by field: docs/protocol.md.

Without the wizard

You can do everything setup does by hand with wrangler and the GitHub UI: docs/manual-setup.md. That page also covers custom domains, org-wide hooks, using a GitHub App instead of per-repo hooks, and rotating keys.

Deploying or updating the hub from a checkout of this repo, step by step with a check after each one: skills/deploy-hub/SKILL.md. Claude Code also loads it as the deploy-hub skill.

Cost and limits

  • Cost: one Worker and one Durable Object (SQLite). Typical webhook volume fits Cloudflare's free plan. WebSocket clients hibernate while idle.
  • Retention: the hub keeps the last 1000 events. A client that stays offline past that sees a gap (first in hello).
  • Size: comment and review bodies are cut at 1000 characters and titles at 300. Use url or the GitHub API for the full text.

Develop

bun install
bun run test                  # worker unit tests + cargo test
bun run dev                   # wrangler dev on localhost:8787 (put secrets in worker/.dev.vars)
bun setup/setup.ts --help     # the wizard from source
bun run build                 # npm packages into npm/dist

Releases: push a v* tag. CI builds the binaries, publishes the npm packages and the crate, and attaches the binaries to a GitHub release (.github/workflows/release.yml).

MIT