resolve-issues
Works through a repository's open GitHub or GitLab issues on its own, most urgent first.
npx skills add https://github.com/microlinkhq/skills --skill resolve-issuesHow it works
- Fixes one issue per pull request, has another agent review each pull request with the loop-review skill through Orca, and leaves a series of independent pull requests ready for human review.
- An issue that needs a person's decision becomes a draft pull request, or a labeled issue comment when there is no code yet, saying what is done, what remains and what to decide, and the run moves on.
- Bugs found on the way become new issues, not extra changes.
User intent
- the user invokes /resolve-issues
Skill file
# Resolve Issues Keep making progress until no actionable issue is left or everything left needs the user. The result is a series of independent pull requests, each closing exactly one issue, each reviewed, each either ready for the user or a draft that says what the user must decide. ## Usage ```text /resolve-issues [--reviewer <orca agent id>] ``` Run it from a checkout of the repository. `--reviewer` picks the agent that reviews every pull request (`claude` by default); `orca agent installed --json` lists the ids. `<skill-dir>` is the directory this `SKILL.md` was read from. `resolve.mjs` means `node <skill-dir>/scripts/resolve.mjs`, which prints JSON on success, and one `resolve-issues: <reason>` line with exit code 1 on failure. It keeps the review in progress, and how many times each pull request was reviewed, in `.git/resolve-issues/state.json`, so neither is lost when the conversation is compacted. ## Before the first issue 1. `git status --porcelain` is empty. If not, stop and say so: the reviewer works in this checkout. 2. `gh auth status` or `glab auth status` passes for the forge of `origin`. 3. `orca status` reports a reachable runtime, and the reviewer is in `orca agent installed --json`. 4. The loop-review skill and the three skills it runs (code-review-and-quality, code-simplification, autopilot) are installed for the reviewer: `npx -y skills add microlinkhq/skills/loop-review`. `resolve.mjs review` finds loop-review under any name prefix in `~/.<reviewer>/skills`, `~/.agents/skills` or `~/.claude/skills`. Pass `--command` when it lives elsewhere. 5. The reviewer can work without a person: its permission settings let it edit files, run tests, and commit and push. A reviewer stopped at a permission prompt is escalated (step 4), which costs that issue. A grok reviewer would also stop at grok's folder-trust question, so `resolve.mjs review` trusts the checkout for grok first (`grok --trust --cwd <checkout> models`, which starts no session). 6. Read the repo's `AGENTS.md`, `CLAUDE.md` and `CONTRIBUTING.md` for how to test, lint, and name branches and commits there. 7. `node <skill-dir>/scripts/resolve.mjs preflight` passes, and prints the `style` command that invokes poteto-mode here. Every run works in pstack's poteto-mode, so pstack must be installed: in Claude Code, `/plugin marketplace add michael-denyer/pstack-claude`, then `/plugin install pstack@pstack-claude`. If a check fails, stop and report which one. ## The loop ### 1. Pick the next issue Invoke poteto-mode first, with the `style` command `preflight` printed (`/pstack:poteto-mode` for the plugin; run `preflight` again if a compaction lost it), at every issue, not once per run: a compaction drops it, and an issue started after one would run without it. Follow it while you work the issue, and read the leaf skill of each principle you apply, as it requires: loading the mode alone does not bring in its playbooks. ```bash node <skill-dir>/scripts/resolve.mjs next ``` It refuses while a review is running, while a stopped one waits for `review-done`, while a pull request this run opened is still open and not reviewed, and while a pull request from the branch checked out here closes the issue it is on but `check-pr` never passed it (run `check-pr` on it, as it says; a pull request someone else opened for that issue just means the issue is taken): finish step 4 first (`review-state` shows where it is), or `settle` a pull request you escalated. It remembers the issue it handed out and hands it back, with `resumed: true`, until the forge marks it (a pull request that closes it, or a label): after a compaction, continue that issue, and treat uncommitted changes (`dirty: true`) as your own work on it. Otherwise `next` is the most urgent open issue, `candidates` how many there are and `upcoming` the first five, in order: priority label (`critical`, `high`, `medium`, none, `low`, written as `priority::high`, `Priority: High`, `High Priority`, `P1` and similar), then bugs, then oldest. `skipped` lists, with a reason each: - an issue that the forge says an open pull request will close, drafts included, - an issue assigned to someone else, - an issue whose label says it waits on a person: `blocked`, `on hold`, `needs input`, `needs decision`, `needs info`, `awaiting response`, `question`, `discussion`, `duplicate`, `invalid` or `wontfix`, in any scope or spelling (`workflow::blocked`, `Status: Blocked`). If `truncated` is `true`, the forge returned only its first 1000 issues or pull requests: say so in the final report. The forge is the only memory this run trusts. Every issue you take or set aside leaves a mark there (a pull request that closes it, or a label), so run `next` at the start of every issue and after any compaction, and trust it over this conversation. Read `next`, then do one of: - **Fix it:** steps 2 to 4. - **It asks for a finding, not code** (measure, check, judge, investigate): do the work, then post the finding as a comment on the issue with its evidence. If the finding calls for a code change, that change is the fix: steps 2 to 4. If it does not, label the issue `needs input` first, then post the comment, ending with the decision you recommend (close it, or what to do next). - **It needs a person** (a rollout, a credential, a purchase, a call on direction): escalate it (step 5). - **It needs a change that is still in an open pull request:** label it `blocked`, then comment which pull request it waits for. Never stack pull requests. Then run `next` again. If `next` is `null`, the run is over: go to the final report. Add the label before the comment, so a compaction between the two never leaves an unmarked issue. When `next` returns `setAside`, a label took that issue off the queue while this run was on it: read its comments, and if this run's record is missing, write it now. Labels you add on GitHub must exist first: `gh label create "<name>"` when `gh label list` lacks it. GitLab creates them. ### 2. Fix it on its own branch If an open pull request already works on the issue without closing it (its description says `Refs #<number>`), do not open a second one: label the issue `blocked`, comment with a link to that pull request, and go to step 1. - `git fetch origin`, then branch from the default branch's latest commit, never from another pull request's branch. Each pull request must merge on its own, in any order. - Reproduce first. A bug fix ships with a test that fails without the fix and passes with it. Run the tests that cover what you touched, and the linter. - Change only what this issue needs. Anything else you find goes to step 6. ### 3. Open the pull request Commit, push, and open it with `gh pr create` or `glab mr create`. The description starts with `Closes #<number>` on its own line, then says why, what changed, and how it was tested. Then check it: ```bash node <skill-dir>/scripts/resolve.mjs check-pr <pull request url> <issue number> ``` It checks that the forge links the pull request to the issue (without the link, `next` hands out the issue again), that it targets the default branch, that it closes no other issue, and that its branch shares no commits with another open pull request. If it fails, fix what it names and check again. When it passes, it records the pull request under its canonical URL (give `review` that URL): `next` refuses to move on until it is reviewed or settled. ### 4. Review it ```bash node <skill-dir>/scripts/resolve.mjs review <pull request url> --agent <reviewer> ``` It refuses a dirty tree, a checkout not on the pull request's branch, unpushed commits, a review already on record, a fourth review of one pull request, and any other agent still working in this checkout. Then it records the review, starts loop-review in a new Orca tab here, and completes the record with the reviewer's pane. - **Another agent is busy here and this run did not start it:** someone else is using the checkout. Try again every 5 minutes for up to 30 minutes, then stop the run and report it. - **The launch reply was lost:** the error names an operation id. Run the same command with `--retry-launch <id>`, never a fresh launch. - **No pane came back:** a reviewer may still have started. Run `review-wait`: it adopts the one agent that turns up working in this checkout within 5 minutes, and says `launch-failed` (run `review-stop`, `review-done`, then `review` again: a launch that never started does not count as one of the three reviews, but a third in a row stops the run) if none does, or `ambiguous` (stop the run and report it) if several do. While the reviewer runs it owns the checkout and the branch: do not edit, commit, or switch branches. Wait for it in this turn, never by ending the turn: ```bash node <skill-dir>/scripts/resolve.mjs review-wait ``` It polls for up to 60 seconds, short enough to stay in the foreground, and returns `final: false` while the reviewer still works: run it again. It returns `final: true` when the reviewer is `done`, `waiting` or `blocked` (Orca's states), `gone` (its tab closed), `stuck` (never started), `stalled` (stopped without a report for 75 minutes, longer than loop-review waits for CI), `launching` with an operation id (a lost launch reply: do what its `next` says), `launch-failed` or `ambiguous` (see above), `timedOut` (3 hours since the launch, kept in `.git/resolve-issues/state.json` so retries do not reset it), or `unreachable` once Orca has failed for 5 minutes. An `unreachable` that is not final is a blip: keep waiting. A final one stops the run: no review can run without Orca, and the record stays for the next run. Then stop the reviewer, whatever the state: ```bash node <skill-dir>/scripts/resolve.mjs review-stop ``` It reads the reviewer's pane, closes its tab, and keeps the verdict on record: `forced` (true unless the reviewer finished with a report), `reviewer` (its last state), `status` and `autopilot` (the report's lines), `report`, and `tail` (the pane's last lines). `review-state` shows it again after a compaction, and `next` and `review` refuse until `review-done`. Clean the checkout: - Run `git rebase --abort`, `git merge --abort` or `git cherry-pick --abort` if one is in progress. A `.git/index.lock` left by the closed reviewer can be deleted once no `git` process runs in this checkout. - **After a forced stop**, uncommitted changes are untrusted: the reviewer may have been in the middle of a mutation. Keep them out of every commit: `node <skill-dir>/scripts/resolve.mjs save-leftovers` saves them on a private ref (`refs/resolve-issues/leftovers/…`, never pushed) and cleans the tree (its `staged` ref keeps what was staged, when that differs). Never `git stash` them: every worktree of the repository shares the stash. - **After a finished review**, uncommitted changes are fixes loop-review left for you. Read them: commit and push the ones that belong to this pull request, `save-leftovers` the rest, and file what they point at (step 6). - `git pull --ff-only` the branch: a reviewer that worked in its own review tree pushed there. Then, with the checkout clean, clear the stopped record. `review` and `settle` both refuse while it is there: ```bash node <skill-dir>/scripts/resolve.mjs review-done ``` It marks the pull request reviewed only when the report is a clean DONE that is `merge-ready` or waits on a person. Then act on the verdict: | Verdict | Then | | --- | --- | | `done`, DONE, `merge-ready` | Ready. | | `done`, DONE, `waiting:` on a person only (an approval, a thread to ask the author about) | Ready for the user. Note what it waits on. | | `done`, DONE, `waiting:` that mentions CI, checks or a pipeline at all (even "CI is green") | Wait for CI with short polls, a minute apart (`gh pr checks <n>`, or the merge request's `head_pipeline` status), never one long blocking command. Green: ready, so `settle <url>` it (`review-done` could not know CI would pass). Red: fix it, push, review again. | | `done`, DONE, `skipped:` | The autopilot skill is missing for the reviewer: stop the run and report it (check 4). | | `done`, BLOCKED, by a problem outside this pull request (CI broken on the default branch, a flaky test) | File it (step 6), then escalate this pull request naming the new issue (step 5). | | `done`, BLOCKED, on a decision about this change | Escalate (step 5). | | `done`, BLOCKED, for any other reason (a pass limit with open findings, a refused push, a setup error) | Fix what the report names, push, review again. | | `waiting` or `blocked` (a permission prompt, or a turn that ended on a question) | Escalate with what it asked: it is in `tail`. Never type into another agent's terminal. | | `gone`, `stuck`, `stalled`, `launch-failed` or `timedOut` | Fix what `tail` and the pushed commits show, push, review again. | Reviewing again means going back to the start of this step. When `review` refuses a fourth review, escalate the pull request instead. Then go to step 1. ### 5. Escalate When an issue needs the user (a decision you cannot safely make, access you do not have, a product call), stop working on it and leave a record that tells the user everything and keeps `next` off the issue: - **There is code:** make its pull request a draft (`gh pr ready --undo <n>` or `glab mr update <n> --draft`), or open it as one (`--draft`), with `Closes #<number>` first and `check-pr` passing. Write the record below into its description, then `node <skill-dir>/scripts/resolve.mjs settle <url>`, so `next` stops waiting for its review. - **There is no code yet:** do not open an empty pull request. Label the issue `needs input`, then comment on it. Either record has these sections: - **Done so far** - **Remaining** - **Decision needed**: the question, the options with their trade-offs, and your recommendation. - **Context**: findings, evidence, and alternatives considered. - **How to resume**: the branch, the commands, and what to do once the user decides. Then go to step 1. One blocked issue never stops the run. ### 6. Capture what you find A bug, flaky test or improvement that is not the current issue becomes a new issue. Search first (`gh issue list --search "<words>"` or `glab issue list --search "<words>"`) and comment on an existing one instead of filing it twice. A new issue says the symptom, how to reproduce it, where in the code it lives, and the evidence. Do not fix it in the current pull request. It gets fixed when `next` picks it. ## Running unattended The user is usually away. Do not ask questions during the run: decide what is reversible, and escalate the rest. Never end the turn while a review is on record or an issue is left: an idle agent lets the machine sleep, and nothing runs until morning. Wait with loops in this turn, and act on each result as soon as it lands. ## Final report When `next` is `null`, or every remaining issue needs the user, report: | Issue | Pull request | State | | --- | --- | --- | | #N title | link | ready, ready but waiting on: …, or draft: the decision needed | Then list the issues answered with a finding, the issues escalated without code (with the decision each needs), the issues labeled `blocked` with the pull request each waits for (remove the label once that pull request merges), the issues created along the way, and the leftover refs `save-leftovers` made (`git for-each-ref refs/resolve-issues/leftovers`). Put the decisions waiting on the user first, most urgent first.