/gh-ops:watchfrom gh-ops
Fetches GitHub notifications, classifies each by type and context, and creates tq actions for follow-up.
Ships in gh-ops. Installing the plugin adds it to Claude Code.
GitHub notifications watcher. Fetch, classify, and create tq actions for each notification.
This skill runs under --permission-mode auto. State boundaries here so the classifier blocks writes.
GitHub: read-only. Allowed: gh pr view, gh issue view, gh release view, gh auth status, gh-fetch-notifications, gh-mark-notification-read, and gh api for GET requests on any path. Forbidden: any gh write subcommand (e.g. gh pr create, gh pr merge, gh pr review, gh issue create, gh issue comment) and any gh api call that includes -X POST/PUT/PATCH/DELETE, --method, -f, or -F.
Repo: no mutations. No git push, git commit, git branch, git checkout, git merge. No Edit / Write / NotebookEdit. Reads (Read, Grep, Glob) are fine.
Local writes only. Allowed writes are limited to the local tq DB (tq action create, tq task create) and marking notifications read via gh-mark-notification-read.
If a step requires a write not on this list, stop and report instead of attempting it.
${CLAUDE_PLUGIN_ROOT}/scripts/gh-fetch-notifications
If the command fails, is blocked by permissions, or returns a non-zero exit code, report the error clearly and stop. Only report "No notifications" when the command succeeds with empty output.
If 0 notifications, output "No notifications" and finish.
For each notification, execute in order:
Extract repo name and number from subject_url, then fetch by subject_type:
gh pr view <number> --repo <owner/repo> --json url,state,author,headRefName,reviewDecision,mergeStateStatus,statusCheckRollup,isDraft,reviews,reviewRequests,comments,bodygh issue view <number> --repo <owner/repo> --json url,state,author,bodygh release view <tag> --repo <owner/repo> (read tag from notification title)gh api /repos/<owner/repo>/discussions/<number>If the body references other PR/Issue numbers (e.g. #1429, follow-up links), resolve each reference safely:
gh pr view <ref> --repo <owner/repo> --json url,stategh issue view <ref> --repo <owner/repo> --json url,stateThis feeds into the "Notification summary" section of the Co-review template (Step 2d, row 7).
Mark as read and skip if:
reason=review_requested and already reviewed (reviews contain own APPROVED/CHANGES_REQUESTED)reason=review_requested but own login (gh auth status --active --json hosts --jq '.hosts."github.com"[0].login') is NOT in reviewRequests (neither as user nor as member of a requested team) — team review request where someone else was randomly assignedstate is MERGED or CLOSED — already terminated, no merge/CI/review action neededIf headRefName matches tq-<number>-:
# e.g. tq-42-fix-bug → action_id=42
# Build result from PR details fetched in 2a
tq action done <action_id> "Remote action created PR: <pr_url>
State: <state>, Review: <reviewDecision>, CI: <pass/fail/pending>, Draft: <yes/no>"
Mark as read and skip.
For actionable notifications, select the first matching instruction by priority:
| Priority | Condition | Instruction |
|---|---|---|
| 1 | reason=review_requested + not yet reviewed | /gh-ops:brief-pr <PR_URL> |
| 2 | mergeStateStatus: "BEHIND" or conflicting | /gh-ops:fix-conflict <PR_URL> |
| 3 | statusCheckRollup has failure | /gh-ops:fix-ci <PR_URL> |
| 4 | reviewDecision: "CHANGES_REQUESTED" / unaddressed review comments | /gh-ops:respond-review <PR_URL> |
| 5 | reviewDecision: "APPROVED" + CI pass + mergeable | /gh-ops:merge-pr <PR_URL> |
| 6 | Own PR, not yet reviewed | /gh-ops:self-review <PR_URL> |
| 7 | Notification is informational only (Discussion, Release, mention without action signal, body referencing follow-up PR/Issue) | Co-review template (see below) |
If row 7 also doesn't fit and the situation truly needs free-text describing, write a detailed instruction including the PR/issue URL, context from the notification, and specific next steps. Do NOT use a slash command in that case.
Co-review actions are discussion-oriented: the dispatched agent must surface context to the user and confirm the next step via AskUserQuestion before acting. Pre-fill the template using data collected in Step 2a.
This action is a co-review discussion with the user. Before taking any action, organize the context below, then use AskUserQuestion to confirm the next step with the user.
**Notification summary**
- Type: <PullRequest / Issue / Discussion / Release>
- URL: <URL>
- State: <PR/Issue state, release tag, or discussion category>
- What happened: <follow-up announcement / mention context / branched into another PR / discussion topic / etc.>
- Related: <state of follow-up #N, related resources>
**Suggested next-step options**
- (a) Mark this task done (information acknowledged, no further tracking needed)
- (b) Register follow-up <#N> as a new task to keep tracking
- (c) <other context-specific proposal>
Present these options via AskUserQuestion and execute the user's choice. If the user picks (a), run `/tq:done`.
Forbidden phrasing in the Co-review template and any free-text instruction (these mislead the dispatched agent into short-circuiting):
Excluded prompts (never select these): classify-gh-notification, classify-next-action, watch-gh-ops
Identify the target project from the notification's repo (check tq project list metadata for matching repos). Then search within that project:
tq search "<keyword>" --project <project_id>
If no project's repos matches the notification, fall back to an unscoped search:
tq search "<keyword>"
Extract keywords from the notification title (PR number #123, ticket ID PROJ-456, repo name, feature name, etc.).
Try in order, use the first match:
# If new task needed
tq task create "<title>" --project <project_id> --meta '{"url":"<url>"}'
# Create action (instruction is the slash command from 2d)
tq action create <instruction> --task <task_id> --title "<title>"
Pass every thread_id (skipped from 2b/2c and processed from Step 2) as arguments to a single invocation. Do not loop with for or chain with && — the permission matcher rejects those leading tokens.
${CLAUDE_PLUGIN_ROOT}/scripts/gh-mark-notification-read <thread_id>...
GitHub notifications processed. Fetched: N, Skipped: M, Actions created: K.
[list of each action summary]
Execute /tq:done.
gh CLI (GitHub API tokens are managed by gh).gh api /repos for PR or issue data — use gh pr view --json / gh issue view --json instead. When no dedicated subcommand exists (e.g. Discussion), fall back to gh api with a GET request, subject to the Auto-mode boundaries above.What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
8 commands in this plugin
npx claudepluginhub mh4gf/tq --plugin gh-opsOther plugins' commands for the same job