/hook-harness:hook-harness [owner] [what to wait for]from hook-harness
Use when waiting for CI or a review, or for any GitHub event, instead of sleeping or polling `gh`: CI or a workflow run on a branch (main after a push, a Publish), an external CI status (CircleCI, Jenkins, Buildkite), a review requested from you or your team, a deployment, a release, merge-queue ejections, slash-command comments, labelled issues. Waits through a hook-harness relay (MCP or CLI). A pull request's own checks and reviews go to pr-shepherd.
Ships in hook-harness. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Reads GitHub events stored by a hook-harness relay (a Lambda plus DynamoDB, 1 day retention). Use the MCP server when available (wait_for_events, get_events); otherwise the CLI (npx -y hook-harness wait). hook-harness serve (a local SSE daemon) is optional and not needed for either path.
hook-harness login --url <function url> --token <hh_...>, or set HOOK_HARNESS_URL and HOOK_HARNESS_TOKEN.hook-harness token create --repos '<owner>/*' --label <who> --login (prints the token once and saves the login). --repos takes owner/name, owner/* or *; --expires takes 90d, 12h, 30m.owner/* or owner/name. A 401/403 means a bad, expired or out-of-scope token. Never print the token in chat or logs.MCP wait_for_events inputs: owner (several as a comma list; one cursor covers them all), repos?, filters? (EventFilter[], OR'd; unknown keys are rejected), after? (cursor), since? (ISO time or duration like 2h), cursor_name? (persist the cursor in a local state file instead of passing after), include_payload? (default true), timeout_seconds? (1–600, default 240) and settle_seconds? (0–60, default 5). get_events takes the same inputs minus the timeouts and runs a single poll. filter_help returns the filter reference with examples. CLI equivalent:
hook-harness wait --owner acme --filter '<json>' --after "$CURSOR" --timeout 30m
Both return {"events":[...],"gap":false,"cursor":"...","timedOut":true?}. The CLI exits 0 in all cases (read the JSON); exit 1 means auth failure, invalid cursor, or relay unreachable until the timeout. The MCP tools report those as tool errors. A 401 means the user must run hook-harness login; a 403 names an owner the token's repo scope doesn't cover, which needs a new token from hook-harness token create --login --repos ...,<owner>/*, not a login.
Rules:
cursor (file, memory, task state) after handling events and pass it as after next time. Without after, both start from since if given, then the named state file (MCP: only with cursor_name; CLI: default or --cursor <name>), then now.id. The same delivery can reappear across polls or as a replay.gap: true means your cursor is older than the retention window and events were lost. Sweep the GitHub API (open PRs, recent runs, issues) to resync, handle events too, then continue from the returned cursor.wait blocks up to the timeout. Claude Code: run the CLI with Bash run_in_background or under Monitor, and keep the MCP tool's timeout_seconds under the client's tool-call limit (MCP_TOOL_TIMEOUT in Claude Code). Codex: use the equivalent background command or a separate session. Loop: wait, handle, persist cursor, wait again.--event --action --reason --conclusion --branch --workflow --command --sender --label --reviewer --sha --ref --app --environment --tag --context --pr --min-association --ignore-sender --repo --no-payload --since --settle --interval --cursor. --filter '<json>' is repeatable; filters are OR'd.--on (MCP: on) takes ejection, main-failure, dependabot-pr, review-requested[:<login|team>], label:<name>, /<command>, workflow:<name>[@<branch>], deployment[:<environment>[@<branch>]], release[:<tag>] and status:<context>, repeatable or comma lists, OR'd with other filters. Prefer them over hand-written JSON. Because they are OR'd, --on <preset> --sha <commit> matches more, not less: to narrow a preset to one commit, write it as a JSON filter with sha in it (3.2), or check headSha on each event.| What you are waiting for | Where it goes |
|---|---|
| A pull request's checks, or a review on your pull request | pr-shepherd, not hook-harness |
| CI on a branch after a push or dispatch (main, a release branch), no PR | workflow:<name>@<branch>, one per workflow the push starts, matched by commit (3.1) |
| CI from a non-Actions system (CircleCI, Jenkins, Buildkite, a GitHub App) | status:<context> or a check_suite filter, with sha (3.2) |
| A review requested from you or your team (you are the reviewer) | review-requested:<login|team> |
If pr-shepherd is not installed, still do not wait on a PR's checks, reviews or comments here: tell the user that pr-shepherd handles them and how to install it.
For CI after a push, read .github/workflows for the workflows whose on: push covers the branch and whose paths/paths-ignore filters match the pushed files (a workflow that does not run sends no event, so waiting on it never ends). Wait on all of them in one call, starting from before the push (--since, or a cursor saved earlier) so a run that finished quickly is not missed: --on workflow:CI@main,workflow:Lint@main --since 15m. Keep waiting until each has a completed event whose headSha is the pushed commit. With no run URL to take a runId from, the commit is the identity. A rerun of the same commit sends another completed event for that workflow; the latest one is the answer. If the wait times out with a workflow still missing, check once whether the commit started it (gh run list --commit <sha> --workflow <name> --repo <owner>/<repo>). If it did not (a path filter, [skip ci], a disabled workflow), tell the user instead of waiting again.
For a workflow on a branch, such as a Publish or deploy you dispatched on main, use workflow:<name>[@<branch>]. The preset splits at the last @, so for a branch whose name contains @ use a filter instead: {"event":"workflow_run","action":"completed","workflow":"<name>","branch":"<branch>"}. It matches the run's workflow_run completed event, whatever the conclusion. Read conclusion (success, failure, cancelled) from the event, and runId to fetch logs with gh run view <runId> --repo <owner>/<repo> --log-failed. CI on a pull request is pr-shepherd's job, not this one (see the routing table above).
hook-harness wait --owner acme --repo acme/app --on workflow:Publish@main --since 10m --timeout 30m --no-payload
--since, or a cursor saved earlier), so a run that finishes quickly is not missed.runId, not headSha. Take it from the run URL that gh workflow run prints (.../actions/runs/<runId>). Do not use gh run list --limit 1 right after dispatching: the new run may not be listed yet, so it returns the previous run. If your gh prints no URL, ask for the run's URL from the Actions page instead of guessing: a run listed since the dispatch can still be someone else's while yours is not listed yet. One wait can return several events, so check every event in the batch and accept the one whose runId matches; wait again on the returned cursor only when none does.get_events once at each check-in instead of polling gh run view. The CLI has no single-poll mode; hook-harness wait --owner acme --repo acme/app --on workflow:Publish@main --after "$CURSOR" --timeout 1s --interval 1s --settle 0s (the same owner and filters as the first wait) returns within about a second.The same rules (start point before the trigger, check the identity, get_events at check-ins) apply to:
environment: job, anything that posts GitHub deployment statuses): deployment:<environment>[@<branch>], e.g. deployment:production@main. It matches deployment_status events whose conclusion is success, failure or error, not pending, queued or in_progress. @<branch> matches only deployers that send a branch as the ref (main or refs/heads/main); some send the commit SHA, so leave the branch off and put the commit in the filter when unsure: {"event":"deployment_status","conclusion":["success","failure","error"],"environment":"<env>","sha":"<commit>"}. Check headSha against the commit you shipped; url is the deploy's log or preview URL.release:<tag>, e.g. release:v2.0.0, or release for any. It matches the release published event; tag and url identify it.status:<context>, e.g. status:ci/circleci: build. Status events carry no branch, so put the commit in the same filter: {"event":"status","conclusion":["success","failure","error"],"context":"ci/circleci: build","sha":"<commit>"}. A separate --sha flag is OR'd with the preset and widens the match. CI that reports through the Checks API (a GitHub App): {"event":"check_suite","action":"completed","app":"<app-slug>","sha":"<commit>"}. On a pull request, leave CI to pr-shepherd.These need the relay's GitHub App to subscribe to Deployment status and Release events (docs/github-app.md). If nothing arrives and the GitHub API shows the deploy or release finished, the App is probably not subscribed: tell the user rather than switching to polling.
A filter ANDs its fields; each field takes a string or array. Fields: repo, event, action, reason, conclusion, branch (baseRef for PR events, else headRef), workflow, command, sender, label, reviewer, sha (headSha, the full 40-character SHA: a short SHA matches nothing; expand it with git rev-parse), ref (headRef or baseRef), pr, minAssociation, ignoreSenders, app (check suite App), ignoreApps, environment (deployments), tag (releases), context (commit statuses). Every action is stored, so always set action or you will match edits, closes and labels you did not mean to.
Merge-queue ejections: use the ejection preset. dequeued also fires with reason: "MERGE" on a successful merge (and MANUAL when someone removes a PR), and filters cannot negate, so the preset lists the failure reasons; reason says why a PR was ejected (e.g. CI_FAILURE, MERGE_CONFLICT).
A label added to an issue or PR (the label:needs-review preset); label is set on labeled/unlabeled actions and reviewer on review_requested:
{ "action": "labeled", "label": "needs-review" }
To react only to one ejection cause, add it: {"event":"pull_request","action":"dequeued","reason":"CI_FAILURE"}.
Failed main CI:
{
"event": ["workflow_run", "check_suite"],
"action": "completed",
"conclusion": "failure",
"branch": "main"
}
/shepherd comments from members:
{
"event": "issue_comment",
"action": "created",
"command": "/shepherd",
"minAssociation": "MEMBER"
}
New issues labelled flaky (inspect payload.label.name; action is labeled for later labels, opened when created with it):
[
{ "event": "issues", "action": "labeled" },
{ "event": "issues", "action": "opened" }
]
Then keep events where payload.label.name == "flaky" or payload.issue.labels[].name contains flaky.
include_payload: false / --no-payload when the envelope is enough.authorAssociation (OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, ...) and author (the comment author; sender is who triggered the delivery and differs on edit and delete). minAssociation is a coarse pre-filter only.minAssociation: MEMBER can miss real members. Before anything privileged (merging, pushing, deploying), verify with the GitHub API (for example gh api orgs/<org>/memberships/<login> or the collaborator permission endpoint).command is only the lowercased first token, so a command match is a trigger, not authorization.What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (jongleberry/hook-harness) — no native marketplace selected
npx claudepluginhub p/jonathanong-hook-harness