Note: Direct CLI usage is not recommended for most users. Prefer installing the agent skill with
npx skills add hdcodedev/gh-contextand using the/gh-context triageslash command instead.This documentation is for advanced users who need the standalone binary.
A CLI tool to fetch and format GitHub Issues and Pull Requests context, ready for use in LLM prompts.
This tool requires the GitHub CLI (gh) to be installed and authenticated.
# macOS
brew install gh
# Authenticate
gh auth loginFor the cleanest install flow, add the skills.sh skill from this repository:
npx skills add hdcodedev/gh-contextUpdate the skill:
npx skills update gh-context
npx skills remove gh-contextInstall from crates.io:
cargo install gh-contextInstall from source locally:
cargo install --path .Once installed, use gh-context directly:
gh-context <input> [OPTIONS]Use cargo run with -- to pass arguments to the CLI:
cargo run -- <input> [OPTIONS]Fetch context for an issue (markdown output to stdout):
gh-context owner/repo#123Bulk fetch open issues for a repo (one file per issue, first page by default, requires --out):
gh-context https://github.com/openai/codex/issues --bulk --out ./codex-issuesBulk fetch multiple pages:
gh-context openai/codex --bulk --pages 3 --per-page 50 --out ./codex-issuesFetch an issue and copy output to clipboard:
gh-context https://github.com/owner/repo/issues/123 --clipSave as JSON:
gh-context owner/repo#123 --format jsonWrite single output explicitly to a file:
gh-context owner/repo#123 --out ./repo-issue-123.mdUse default smart inference with a natural-language request:
gh-context "find me one actionable issue"--format <json|md>: Output format (default:md)--out <path>: Write output to file or directory. Required with--bulk--clip: Copy output to clipboard (macOS only)--issue: Treat input as issue (kept for backwards compatibility, no longer needed)--bulk: Fetch multiple issues for a repo (list mode)--state <open|closed|all>: Issue state filter for bulk mode (openby default)--per-page <n>: Items per page for bulk mode (default:30)--pages <n>: Number of pages to fetch in bulk mode (default:1)
- Single issue mode prints to stdout by default.
- Use
--outto write a single issue result to a file. - Bulk mode requires
--outand writes files to the specified directory.
This repository also includes an installable agent skill in .agents/skills/gh-context/.
npx skills add hdcodedev/gh-contextUse slash command form for the skill.
/gh-context owner/repo#456
/gh-context 123
Explain the best next step and why it is important.
If you are in a repository, you can also run it without arguments:
/gh-context
This will infer the current repo from the git origin remote and select the top open issue candidate.