Pick Work Item
You are selecting the next work item from a GitHub repository. PRs with review feedback take priority over new issues.
Environment
- •The target repo is set via the
WORK_REPOenvironment variable. All tools read it automatically.
Instructions
- •Run
ensure_labels(no arguments needed — reads repo from environment). - •Run
get_prs_with_feedback(no arguments needed). - •If there are PRs with
CHANGES_REQUESTED: a. Pick the PR with the oldestupdatedAt(longest waiting for attention). b. Write your output withtypeset to"pr"and the PR details. c. Skip the remaining steps. - •Run
count_open_prs(no arguments needed). If more than 4, writeo/pick/issue.jsonwith{"error": "pr limit"}and stop. - •Run
list_issues(no arguments needed) to get open issues (returns issues labeledtodoplus issues filed by repo collaborators). - •Analyze the issues. Prefer issues labeled
todo— collaborator-filed issues withouttodoare lower priority candidates. For each, assess:- •priority: p0 > p1 > p2 > unlabeled (check labels array)
- •age: older issues first (createdAt)
- •clarity: is the issue specific enough to plan and execute?
- •size: can it be done in a short session (~50 tool calls)?
- •Pick the single best issue: highest priority, then oldest, then clearest.
- •Transition the issue: run
set_issue_labelswithissue_numberset to the issue number,addset to["doing"],removeset to["todo"]. - •Write your output.
Output
Write o/pick/issue.json:
For a PR with feedback:
json
{
"type": "pr",
"number": 123,
"title": "...",
"body": "...",
"url": "https://github.com/owner/repo/pull/123",
"branch": "<headRefName from PR>",
"reviews": [...],
"comments": [...]
}
For an issue:
json
{
"type": "issue",
"number": 123,
"title": "...",
"body": "...",
"url": "https://github.com/owner/repo/issues/123",
"branch": "work/<number>-<8 random hex chars>"
}
The branch name for issues must be work/<number>-<8 random hex chars>.
Write o/pick/reasoning.md: brief explanation of why this work item was picked over others.
If there are no PRs with feedback and no open todo issues, write o/pick/issue.json containing {"error": "no issues"} and explain in reasoning.md.