$npx -y skills add SafeAI-Lab-X/ClawKeeper --skill gh-issuesFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [
| 1 | # gh-issues — Auto-fix GitHub Issues with Parallel Sub-agents |
| 2 | |
| 3 | You are an orchestrator. Follow these 6 phases exactly. Do not skip phases. |
| 4 | |
| 5 | IMPORTANT — No `gh` CLI dependency. This skill uses curl + the GitHub REST API exclusively. The GH_TOKEN env var is already injected by OpenClaw. Pass it as a Bearer token in all API calls: |
| 6 | |
| 7 | ``` |
| 8 | curl -s -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" ... |
| 9 | ``` |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ## Phase 1 — Parse Arguments |
| 14 | |
| 15 | Parse the arguments string provided after /gh-issues. |
| 16 | |
| 17 | Positional: |
| 18 | |
| 19 | - owner/repo — optional. This is the source repo to fetch issues from. If omitted, detect from the current git remote: |
| 20 | `git remote get-url origin` |
| 21 | Extract owner/repo from the URL (handles both HTTPS and SSH formats). |
| 22 | - HTTPS: https://github.com/owner/repo.git → owner/repo |
| 23 | - SSH: git@github.com:owner/repo.git → owner/repo |
| 24 | If not in a git repo or no remote found, stop with an error asking the user to specify owner/repo. |
| 25 | |
| 26 | Flags (all optional): |
| 27 | | Flag | Default | Description | |
| 28 | |------|---------|-------------| |
| 29 | | --label | _(none)_ | Filter by label (e.g. bug, `enhancement`) | |
| 30 | | --limit | 10 | Max issues to fetch per poll | |
| 31 | | --milestone | _(none)_ | Filter by milestone title | |
| 32 | | --assignee | _(none)_ | Filter by assignee (`@me` for self) | |
| 33 | | --state | open | Issue state: open, closed, all | |
| 34 | | --fork | _(none)_ | Your fork (`user/repo`) to push branches and open PRs from. Issues are fetched from the source repo; code is pushed to the fork; PRs are opened from the fork to the source repo. | |
| 35 | | --watch | false | Keep polling for new issues and PR reviews after each batch | |
| 36 | | --interval | 5 | Minutes between polls (only with `--watch`) | |
| 37 | | --dry-run | false | Fetch and display only — no sub-agents | |
| 38 | | --yes | false | Skip confirmation and auto-process all filtered issues | |
| 39 | | --reviews-only | false | Skip issue processing (Phases 2-5). Only run Phase 6 — check open PRs for review comments and address them. | |
| 40 | | --cron | false | Cron-safe mode: fetch issues and spawn sub-agents, exit without waiting for results. | |
| 41 | | --model | _(none)_ | Model to use for sub-agents (e.g. `glm-5`, `zai/glm-5`). If not specified, uses the agent's default model. | |
| 42 | | --notify-channel | _(none)_ | Telegram channel ID to send final PR summary to (e.g. -1002381931352). Only the final result with PR links is sent, not status updates. | |
| 43 | |
| 44 | Store parsed values for use in subsequent phases. |
| 45 | |
| 46 | Derived values: |
| 47 | |
| 48 | - SOURCE_REPO = the positional owner/repo (where issues live) |
| 49 | - PUSH_REPO = --fork value if provided, otherwise same as SOURCE_REPO |
| 50 | - FORK_MODE = true if --fork was provided, false otherwise |
| 51 | |
| 52 | **If `--reviews-only` is set:** Skip directly to Phase 6. Run token resolution (from Phase 2) first, then jump to Phase 6. |
| 53 | |
| 54 | **If `--cron` is set:** |
| 55 | |
| 56 | - Force `--yes` (skip confirmation) |
| 57 | - If `--reviews-only` is also set, run token resolution then jump to Phase 6 (cron review mode) |
| 58 | - Otherwise, proceed normally through Phases 2-5 with cron-mode behavior active |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## Phase 2 — Fetch Issues |
| 63 | |
| 64 | **Token Resolution:** |
| 65 | First, ensure GH_TOKEN is available. Check environment: |
| 66 | |
| 67 | ``` |
| 68 | echo $GH_TOKEN |
| 69 | ``` |
| 70 | |
| 71 | If empty, read from config: |
| 72 | |
| 73 | ``` |
| 74 | cat ~/.openclaw/openclaw.json | jq -r '.skills.entries["gh-issues"].apiKey // empty' |
| 75 | ``` |
| 76 | |
| 77 | If still empty, check `/data/.clawdbot/openclaw.json`: |
| 78 | |
| 79 | ``` |
| 80 | cat /data/.clawdbot/openclaw.json | jq -r '.skills.entries["gh-issues"].apiKey // empty' |
| 81 | ``` |
| 82 | |
| 83 | Export as GH_TOKEN for subsequent commands: |
| 84 | |
| 85 | ``` |
| 86 | export GH_TOKEN="<token>" |
| 87 | ``` |
| 88 | |
| 89 | Build and run a curl request to the GitHub Issues API via exec: |
| 90 | |
| 91 | ``` |
| 92 | curl -s -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \ |
| 93 | "https://api.github.com/repos/{SOURCE_REPO}/issues?per_page={limit}&state={state}&{query_params}" |
| 94 | ``` |
| 95 | |
| 96 | Where {query_params} is built from: |
| 97 | |
| 98 | - labels={label} if --label was provided |
| 99 | - milestone={milestone} if --milestone was provided (note: API expects milestone _number_, so if user provides a title, first resolve it via GET /repos/{SOURCE_REPO}/milestones and match by title) |
| 100 | - assignee={assignee} if --assignee was provided (if @me, first resolve your username via `GET /user`) |
| 101 | |
| 102 | IMPORTANT: The GitHub Issues API also returns pull requests. Filter them out — exclude any item where pull_request key exists in the response object. |
| 103 | |
| 104 | If in watch mode: Also filter out any issue numbers already in the PROCESSED_ISSUES set from previous batches. |
| 105 | |
| 106 | Error handling: |
| 107 | |
| 108 | - If curl returns an HTTP 401 or 403 → stop and tell the user: |
| 109 | > "GitHub authentic |