Read a GitHub issue with all comments and linked content to add as working context. Use when the user provides a GitHub issue URL or reference.
Fetch a GitHub issue and all related content to build full context for a task.
The user provides a GitHub issue reference in one of these forms:
https://github.com/owner/repo/issues/123owner/repo#123#123Extract owner, repo, and issue number from the input. Use gh to fetch the issue:
gh issue view <number> --repo <owner/repo> --json title,body,state,labels,assignees,milestone,createdAt,author,url
gh api repos/<owner>/<repo>/issues/<number>/comments --paginate
Extract each comment's user.login, created_at, and body.
Scan the issue body and all comment bodies for:
https://github.com/<owner>/<repo>/issues/<n> or /pull/<n>#<n> or <owner>/<repo>#<n>https:// links (docs, wikis, designs, etc.)Deduplicate the collected links.
For each linked GitHub issue or PR, fetch a summary:
gh issue view <number> --repo <owner/repo> --json title,body,state,labels,url
gh pr view <number> --repo <owner/repo> --json title,body,state,url,files
Keep these summaries concise — title, state, and body are the priority.
Use WebFetch to retrieve content from non-GitHub URLs. Extract the key information relevant to the issue context. Skip URLs that are:
.png, .jpg, .gif, .mp4, etc.)Output everything as a structured context summary:
## Issue: <title> (<state>)
**URL**: <url>
**Author**: <author> | **Created**: <date>
**Labels**: <labels> | **Milestone**: <milestone>
### Description
<body>
### Comments (<count>)
**<user>** (<date>):
<comment body>
---
### Linked Issues/PRs
#### <title> (<state>) — <url>
<body summary>
---
### External References
#### <url>
<fetched content summary>
gh CLI — never construct API URLs for raw curl calls--paginate to ensure none are missedgh auth fails or a repo is inaccessible, report it clearly and continue with what's available