@ravshansbox/pi-next-issue
Pi extension that works through GitHub issues with the next-issue worker
Package details
Install @ravshansbox/pi-next-issue from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@ravshansbox/pi-next-issue- Package
@ravshansbox/pi-next-issue- Version
13.2.0- Published
- Nov 18, 2026
- Downloads
- not available
- Author
- ravshansbox
- License
- MIT
- Types
- extension, skill
- Size
- 119.6 KB
- Dependencies
- 1 dependency · 3 peers
Pi manifest JSON
{
"skills": [
"./skills"
],
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-next-issue
A pi extension that works through the open GitHub issues of a repository in the background, while you keep using pi. The work is done by the next-issue worker, which this extension starts and talks to.
pi install npm:@ravshansbox/pi-next-issue
It needs git, npx and an authenticated gh. It works on macOS and Linux. The repository must be on GitHub: github.com or a GitHub Enterprise host, which gh must be logged in to. Pi passes that host to gh when it is not github.com. Other hosts, such as GitLab, are not supported.
Use
Run this in pi, inside a git repository:
/next-issueopens the dashboard in the terminal. Without the terminal UI, for example in an rpc client, it opens a menu of the actions that fit the run of this repository instead: Start when no run is going; Stop, Watch on or Watch off, Hunt on or Hunt off, and Refresh when a run is going. Each switch offers the setting that the run does not have. Text typed after/next-issueis ignored: the dashboard or the menu opens all the same, and pi suggests nothing after/next-issue. Closing a menu does nothing.- Start starts a run of this repository, as
next-issue startdoes: the run watches and does not hunt. It handles the issues it finds, then waits and reads the open issues again. Watch off makes it end after the current pass, and Hunt on turns hunting on. Before 12.0.0, Start did one pass with watching off. - Watch on makes the going run of this repository keep watching for new issues after the current pass, with no restart: it reads the open issues again after each pass, like
next-issue watch on. Watch off makes it end after the current pass, or at once when it waits between passes, asnext-issue watch offand a run with--watch offdo. Off also turns hunting off. Watch on for a run that you asked to stop changes nothing, and a note saysnext-issue cannot watch: the run is stopping. - Hunt on and Hunt off switch hunting for bugs on or off for the going run of this repository, with no restart: the run keeps its issues, worktrees and progress. On also turns watching on, when the run does not watch. Off lets a hunt that is going finish, so the issues it files stay, and starts no new hunt. On wakes the hunter at once, with no back-off wait; the hunter then hunts only while fewer than
huntCapready issues wait, see Hunt for bugs. The setting lasts for that run only. It works for every run of the worker,next-issue startruns too. Hunt on for a run that you asked to stop changes nothing, and a note saysnext-issue cannot hunt: the run is stopping. - Refresh asks the going run of this repository to check for new issues now, like the
next_issue_refreshtool, and shows its result as a note, for exampleAsked the run of <root> to check for new issues now. - Stop in the menu opens a second menu that asks when to stop the run of this repository; the dashboard offers each stop point as its own action:
- After the running issues: the run claims no new issue and starts no new hunt. It finishes the issues that it holds and a hunt that is going, then ends as
stopped. - After the current round: each running issue stops after its current round and keeps its saved state, worktree and labels, so the next run resumes it. A hunt that is going ends first.
- At once: the run stops every agent, command and hunt at once. The worker keeps running.
- A stop with a later point than one already asked for changes nothing. A stop with an earlier point replaces it.
- After the running issues: the run claims no new issue and starts no new hunt. It finishes the issues that it holds and a hunt that is going, then ends as
- The dashboard opens over the conversation. Esc closes it. It has a tab bar with four tabs, and Tab moves to the next one:
- Active shows the going run of this repository: its status, whether it watches and hunts, the open-issue count, each running issue with its stage, tool count and time spent, each handled issue with its outcome, and the error when there is one. It updates as the run moves. When no run is going, it says so, with the status and error of the last run, and offers Start. When a run is going, it offers Stop after the running issues, Stop after the current round of each running issue, Stop at once, Watch on or Watch off, Hunt on or Hunt off, and Refresh. ↑ and ↓ choose a running or handled issue or an action. Enter on an issue opens its detail view, and Enter on an action runs it. Each action does what the same action of the menu does, with the same notes, and the dashboard stays open.
- Past lists the runs kept under
.next-issue/runs/(seekeepRunDaysin the config), newest first, each with its start time in UTC and its end state:finished,stopped,failed(its run log holds arun.failorissues.failline, for example whenghfails at the start or an issue crashes the run), ornot endedfor a run that is going or was killed. ↑ and ↓ choose a run. Under the list, it shows the chosen run: its error when it failed, each issue with its outcome and reason, and from the run summary the total tokens and the tokens and time of each role. A run with no summary file showsNo run summary. When the list and the chosen run do not fit the overlay, the list shows only the runs around the chosen one, and PgUp and PgDn scroll the chosen run. It reads the files each time you open the tab. Enter on a run lets ↑ and ↓ choose one of its issues, Enter opens the detail view of that issue in that run, and Esc goes back to the run list. - The detail view of an issue shows, from the run (the newest run when opened from Active): the run events of the issue in time order, from
.next-issue/runs/<runId>.jsonl, with times in UTC; the lines of the issue in.next-issue/worker.log, from every run the log still holds, with times in local time; and the full agent session of each role that worked on the issue (implementer, reviewer, fixer), from.next-issue/runs/<runId>/sessions/, in the order the agents ended. A session shows the prompt, the thinking, the replies, the tool calls and the tool results, not the system prompt. A session shows up once its agent ends. Opened from Active, the view updates as the run moves, rereading the files at most once a second. ↑ and ↓ scroll a line, PgUp and PgDn scroll a page, and Esc goes back to the tab it was opened from. - Hand-overs lists the issues that wait for a person, each with its number, title, reason and url. Pi asks the worker for the list each time you open the tab. When no worker is running, the tab says it cannot list them and points to the
answer-hand-overskill. ↑ and ↓ choose an issue and Enter offers the answers: Retry, Retry with guidance and Give up. Each answer has the same effect on GitHub as in theanswer-hand-overskill, see Investigate a hand-over. Retry swaps theneedsHumanlabel for thereadylabel in one edit, or only removes it whenreadyis empty. Retry with guidance asks for the guidance, posts it as a comment, then swaps the labels the same way; Enter posts it and Esc goes back. The guidance must not start with### next-issue ·or with a heading of older versions (next-issue needs help:,### Review:,### Fixer:and### Already done). Give up swaps theneedsHumanlabel for theskiplabel, and creates that label first when the repository does not have it. When the create fails, it reads the labels again and uses the label when another session created it meanwhile. After a retry, pi asks the going run to check for issues now. An answered issue leaves the list, and the tab shows what happened or the error. - Upcoming lists the issues the worker would claim next: the open issues with the
readylabel of the config, oldest first as the worker claims them, each with its number and title. Issues that are blocked by open issues are listed apart under Blocked, each with the issues that block it. Issues with saved state, which the worker resumes, are not listed. Pi asks the worker for the list each time you open the tab, and showsLoading the upcoming issues…until it answers. When no worker is running, the tab says it cannot list them. A worker older than pi does not answer, and the tab then says the worker needs an upgrade. ↑ and ↓ scroll a list that does not fit.
- The
next_issue_starttool lets the model start a run. It takes no argument. When no run is going, it starts a run like Start in/next-issue. When a run is going, it starts nothing, asks that run to check for new issues now (arefreshmessage, so an issue filed just before is claimed with no back-off wait) and reports the run. When that run is stopping, it asks nothing, since the run would ignore it, and its result endsIt is stopping, so it was not asked to check for new issues.When that run does not watch for new issues, it asks nothing for the same reason, and its result endsIt does not watch for new issues, so it was not asked to check for new issues.It never stops a run (usenext_issue_stop), and it does not ask for confirmation. Its result says whether it started a run. - The
next_issue_refreshtool lets the model ask the going run of this repository to check for new issues now (arefreshmessage), for example right after it files an issue. It reportsAsked the run of <root> to check for new issues now.When no run of this repository is going, or no worker is running, it starts nothing (no worker, no run) and reportsNo run of <root> is going, so nothing was asked.When the going run does not watch for issues, it asks nothing and reportsThe run of <root> does not watch for new issues, so it would ignore the request and nothing was asked.When the going run is stopping, it asks nothing and reportsThe run of <root> is stopping, so it would ignore the request and nothing was asked. - The
next_issue_watchtool lets the model switch watching of the going run on or off, like Watch on and Watch off in/next-issue, with anonargument,trueorfalse. It waits for the worker and returns the new setting, or fails with the reason when no run is going, or withthe run is stoppingwhenonistruefor a run that a person asked to stop. When no worker is running, it fails withno run of <root> is goingand starts none. - The
next_issue_hunttool lets the model switch hunting of the going run on or off, like Hunt on and Hunt off in/next-issue, with anonargument,trueorfalse. It waits for the worker and returns the new setting, or fails with the reason when no run is going, or withthe run is stoppingwhenonistruefor a run that a person asked to stop. When no worker is running, it fails withno run of <root> is goingand starts none. - The
next_issue_stoptool lets the model stop the going run, like Stop in/next-issue, with an optionalafterargument,issue(the default),roundornow. It does not ask for confirmation and does not wait for the run to end: it returns at once and says that the run of the repository was asked to stop and at which point, for exampleAsked the run of /repo to stop after the running issues.It fails withno run of <root> is goingwhen no run is going, and starts no worker when none is running. - The
next_issue_statustool lets the model see the run of this repository. It returns the footer line,watching onorwatching offandhunting onorhunting offwhile the run is going, then one line per handled issue with its outcome, for example#190 done. When the worker has no run of this repository, it returnsno run of <root>. When no worker is going, it returnsno worker is runningand does not start one. It reports no other repository.
The footer starts with the number of open issues at the latest fetch, then shows each running issue with its stage and the time spent on it, for example 7 issues · #12 · review 2/5 · 4m | #13 · implement · 40s. The open count is the number of open issues that the run lists, including the running issues and the ones it skips. The run reads it from GitHub each time it lists the open issues: at the start of each pass, after each issue ends (also when the run stops after a closed issue), right after a hunt files an issue, and on a refresh. Nothing adds to it or takes from it in between, so an issue opened or closed outside the run shows at the next of these reads. A stage with a limited number of rounds shows the round and its limit:
review 2/5: the reviewer reviews the change.review fix 2/5: the fixer works on the findings of the review.local fix 1/5: the fixer works on a failed command fromchecksbefore the push.conflict fix 1/5: the fixer resolves a merge conflict with the base.checks fix 1/5: the fixer works on failed checks on the base after the push.commit fix 1/10: the agent works on a failed commit hook.
local fix, conflict fix and checks fix share one limit, maxCiFixes, from the config.
Other lines read, for example, 7 issues · looking for issues or #12 · stopping. When a run finishes or stops, the line is cleared. When a run fails, it shows the error, for example failed: gh failed. In the terminal, it uses the dim colour of the theme, like the rest of the footer.
Answer questions
When an issue waits for a person, with the needsHuman label of the config, the footer shows the count, for example 2 questions waiting. It does not interrupt what you do. Pi asks the worker for the list when it connects and every minute, and the worker also sends it after each issue of a run. A question answered on GitHub or in another pi leaves the count with the next list.
Answer a question on the Hand-overs tab of the dashboard, or with the answer-hand-over skill, see Investigate a hand-over. When the issue halted a run with a commit on the base whose checks nobody read, Give up also lets the next runs land other issues again, see Stops for a loop.
To drop an issue for good, close it on GitHub instead. The next run removes its saved state, branches and worktree, see Retry an issue that waits for a person.
Investigate a hand-over
The package ships the answer-hand-over skill. Ask pi to answer a question or a hand-over, or run /skill:answer-hand-over. Pi then:
- lists the open issues with the
needsHumanlabel and lets you pick one; - checks the permission of each comment author first, reads the text of comments from users with write access only, as data and not instructions, and finds the latest
### next-issue · Hand-over: needs helpcomment (ornext-issue needs help:of older versions) and itsquestion:lines; it reads the commits and the diff of the issue branch when there is one, and the logs of the failed checks when the hand-over names them; - explains the blocker in plain words;
- asks numbered questions, with lettered options and a recommendation, until it knows whether to retry, retry with guidance or give up;
- answers on GitHub: Retry swaps the
needsHumanlabel for thereadylabel in onegh issue edit(with an emptylabels.ready, it only takes the label off), Retry with guidance posts one comment that does not start with a heading of the harness and then swaps the labels the same way, and Give up takes the label off and adds theskiplabel, which it creates first when the repository lacks it and reuses when it differs only in case; - after a retry, calls
next_issue_refresh, and asks only whether to start a run when none is going, or whether to turn watching on (next_issue_watch) when the going run does not watch. When the going run is stopping, it says so and asks nothing.
Pi finds the repository as the create-issue skill does and passes --repo to every gh command. It does not fix the code of the issue.
Create an issue
The package ships the create-issue skill. Ask pi to write an issue, ask for a change in a repository with .next-issue/config.json, or run /skill:create-issue <problem>. Pi then:
- restates the problem, reads the code when the problem touches it, and finds the open issues that must be done first;
- judges whether the change fits one atomic commit that leaves the trunk green. When it is too big for one atomic commit, it proposes a split into issues that each land alone and keep the trunk green;
- asks numbered questions until none is open, including whether you confirm the split;
- creates the ready label with
gh label createwhen the repository does not have it, then runsgh issue create --body-file --blocked-bywith the body fromtemplate.md, the issues it depends on and no label, without showing the body first. The issue carries its blocker links from the moment it exists, so the worker waits for them even whenlabels.readyis empty and a run claims every open issue. It needs GitHub CLI 2.94.0 or later; - adds the ready label with
gh issue edit --add-labelonly after it links every blocker. It adds the ready label and no other label. The ready label is thelabels.readylabel of.next-issue/config.json, orstatus:todowhenlabels.readyis not set or there is no config file. With an emptylabels.ready, the issue gets no label, since the worker then claims every open issue. For a confirmed split, it creates each issue in turn with the links to the issues of the split it depends on, and only then adds its ready label; - calls
next_issue_refreshwith no question first. When a run is going, it gives you the issue url, says the run was asked to check for new issues now, and asks nothing. When no run is going, it gives you the url and asks only whether to start a run, and callsnext_issue_startwhen you say yes. When the going run does not watch, it gives you the url and asks only whether to turn watching on, and callsnext_issue_watchandnext_issue_refreshwhen you say yes. When the going run is stopping, it gives you the url, says the run will not claim the issue, and asks nothing; - changes the issue with
gh issue edit --body-fileor--titlewhen you ask for a change.
Pi files the issue, the ready label and the blocker links in the repository of the remote of .next-issue/config.json, or of origin when there is no config file or no remote field, as the worker does. It passes --repo to every gh command, so another remote, such as the upstream of a fork, never gets the issue.
The issue gets the ready label as soon as its blockers are linked, so a run that is already going may claim it before you review it.
Pi does not implement the issue in that session. The worker does the work. The body holds the sections of the issue format.
Worker
The extension does no work itself. On Start in /next-issue or next_issue_start, it connects to the next-issue worker of the repository on the socket file .next-issue/worker.sock in the repository. When no worker answers, it starts one in the repository with npx -y next-issue@<version> serve, where <version> is the version of the extension, or latest when the extension runs from a source checkout with version 0.0.0, in the background, and writes the output of the worker to .next-issue/worker.log in the repository. The worker keeps that file within 10 MiB: it cuts a larger file to its newest 5 MiB when it starts and once a minute while it runs. On Stop, Watch, Hunt or Refresh in /next-issue (the menu or the dashboard), or next_issue_stop, next_issue_watch or next_issue_hunt, it only connects to a worker that is running, and never starts one. When the path of the socket file is too long for the system, the extension says so and starts nothing. Each pi keeps at most one connection to the worker. When a worker accepts the connection but sends no runs within 5 seconds, the call fails with the next-issue worker did not answer.
When a process that does not listen holds the lock file .next-issue/worker.lock for more than 2 seconds, the extension starts a worker anyway, which exits with another worker is running. When the worker that the extension starts exits before it listens, the extension says so at once with its exit code and points to .next-issue/worker.log, for example the next-issue worker exited before it listened: exit code 1 (see .next-issue/worker.log). A worker that starts slowly, for example while npx downloads it, still connects, for up to 2 minutes.
- Each repository has its own worker. Every pi in a repository shares the worker of that repository and shows its run, whoever started it. A run, restart or upgrade in one repository never affects another.
- Opening pi does not start a worker. It only shows a run when a worker is going. When the worker goes away, for example after
npx next-issue stop, pi clears the run and the questions count from the footer, and shows them again once a worker answers. - The run does not belong to pi: it goes on after
/new,/resume, a fork, a reload or quitting pi. - The worker exits when no run is going and no pi is connected. Stop it at once with
npx next-issue stopin the repository. - Versions before one worker per repository ran one worker for the machine, which does not stop by itself and can keep claiming issues alongside the new worker. Stop it once after you upgrade, as the
next-issueREADME says. - When the extension is newer than the worker of a repository, that worker closes once no run is going, and the extension starts the newer worker. Workers of other repositories carry on. A run that watches (watch or hunt on) is upgraded between issues: once pi connects, the run claims nothing new and stops after its running issues and its current hunt, as Stop after the running issues does. The footer and
next_issue_statusshow#7 · upgrading to 1.3.0. Once the run ends, the old worker starts the newer worker (withnpx -y next-issue@<version> serve, as pi does) and the run again with the same watching and hunting settings, then closes, even when no pi is open by then. With several pi sessions open, one newer worker and one run start. When the old worker cannot start the newer one,.next-issue/worker.logholds the reason. A worker released before this change does not start the newer worker itself: it closes, and the newer extension starts the newer worker and the run again. A run thatnext-issue startstarted in a terminal is upgraded the same way, andnext-issue startfollows it to the newer worker and on to its end. A run that does not watch is left alone and the worker upgrades when it ends. After a stop by a person the run does not start again. While a run of an older worker is going, Watch and Hunt in/next-issue,next_issue_watchandnext_issue_huntshow an error and send nothing: stop the run, then start it again on the newer worker.
Each run lands approved changes straight on the base branch, with no pull request, as ADR 0003 records, as an application of the humanless flow of ADR 0004. See the next-issue README for what a run does, its labels, its state and its config.