gh-stack is a GitHub CLI extension for managing stacked branches and pull requests, where each small change builds on the branch below it. Developers use it to create, rebase, submit, and navigate reviewable PR chains, and the catalogue entries help coding agents operate the extension.
Borrowing it
Nothing to install: this file belongs to github/gh-stack. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/github/gh-stack/main/.github/copilot-instructions.mdgit clone --depth 1 https://github.com/github/gh-stackWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/github/gh-stack/copilot-instructions)<a href="https://agentmods.dev/instructions/github/gh-stack/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/github/gh-stack/copilot-instructions/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/github/gh-stack/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/github/gh-stack/copilot-instructions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01063 | $0.01063 |
| Opus 5.5 | $0.00425 | $0.00425 |
| Sonnet 5.5 | $0.00213 | $0.00213 |
| Haiku 4.5 | $0.00106 | $0.00106 |
Grade A, and why
gh-stack copilot-instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 49 lines — stays where its author put it; the contents beside it link to each section on GitHub.
gh-stack: Copilot Instructions
A Go CLI extension (gh stack) for managing stacked branches and pull requests. Uses Cobra for commands, bubbletea/lipgloss for TUI, and stretchr/testify for tests.
Repository operations require Git 2.36+.
Build and validate
go mod download # install deps
go build -o gh-stack . # build
go vet ./... # static analysis. Always run before tests.
go run ./scripts/test -workers 4 # full race-enabled suite in isolated processes
Run vet before tests. See CONTRIBUTING.md for canonical/targeted commands and runner details. Do not add t.Parallel to tests that change Git mocks, cwd, or environment variables.
No Makefile, no code generation, no external linter config. Standard Go toolchain only.
Project layout
cmd/: One Cobra command per file. Each exports<Name>Cmd(cfg *config.Config)with logic inrun<Name>().internal/git/:Opsinterface wrapping git CLI.MockOpsfor tests. UseForWorktree(path)for scoped execution,CommonDir()for shared storage, andGitDir()for native per-worktree state. Never use productionos.ChdirorSetOpsto switch context.internal/github/:ClientOpsinterface (18 methods) for GitHub API.MockClientfor tests. Stack operations use the public Stacks REST API (/repos/{owner}/{repo}/stacks); merges use the async merge API (/repos/{owner}/{repo}/pulls/{n}/merge-async) with an explicitmerge_action(direct_mergeormerge_queue) chosen from the base branch's merge-queue detection.merge_actionis optional — omitting it (or sendingdefault) lets the server auto-route (merge queue if one is configured, else direct merge) — but the CLI sends it explicitly so a wrong detection fails loudly instead of silently merging directly.internal/config/:Configstruct passed to all commands. Holds I/O, colors, and test hooks (SelectFn,ConfirmFn,InputFn,GitHubClientOverride).internal/stack/: Shared catalog (<common-dir>/gh-stack, JSON), conservative legacy migration, atomic saves, and short catalog locks.internal/worktree/: Origin/owner identities, cleanliness preflight, scoped operations, and touched-ref recovery.internal/theme/: GitHub-branded palette (single source of all hex colors), plain-output colorizers, andCanvasOutput, which paints GitHub's canvas behind full-screen TUIs.internal/tui/: bubbletea views (stackview,modifyview).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago Changed · +2 lines · +83 tokens per session 529daf0fde8c
- 14d ago Changed · +2 lines · +54 tokens per session 19fee3723a36
- 1mo ago Changed · +8 lines · +297 tokens per session 0f569c4036dd
- 2mo ago First seen · 37 lines · 629 tokens per session scan A 4c49e960762f
gh-stack copilot-instructions.md is an instructions file published in the GitHub repository github/gh-stack (1,749 stars, last pushed 3d ago), licensed MIT. It adds 1,063 tokens to every session, about $0.0043 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
gh-stack copilot-instructions.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| gh-stack copilot-instructions.mdgithub/gh-stack | Instructions file | 1.7k | 3d ago | MIT | A | 1,063 | GitHub Copilot |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 5,516 | GitHub Copilot |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |