Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/github/gh-stack/copilot-instructionsgit clone --depth 1 https://github.com/github/gh-stackWhat 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 | $0.00629 | $0.00629 |
| Opus 5 | $0.00315 | $0.00315 |
| Sonnet 5 | $0.00126 | $0.00126 |
| Haiku 4.5 | $0.00063 | $0.00063 |
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 yesterday.
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 — 37 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.
Build and validate
go mod download # install deps
go build -o gh-stack . # build
go vet ./... # static analysis. Always run before tests.
go test -race -count=1 ./... # tests with race detection
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 (52 methods) wrapping git CLI.MockOpsfor tests. Package-level functions delegate to swappableopsvariable.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/: Stack file (.git/gh-stack, JSON) management with file locking.internal/tui/: bubbletea views (stackview,modifyview).
Coding conventions
- Return typed
ExitErrorsentinels (codes 1-10 incmd/utils.go) fromRunE. Never callos.Exit()directly. - Check errors with
var exitErr *ExitError; errors.As(err, &exitErr). - Table-driven tests with
t.Run()subtests. - Use
config.NewTestConfig()for test configs with captured I/O. - Mock git:
restore := git.SetOps(&git.MockOps{...}); defer restore(). Always defer restore. - Mock GitHub:
cfg.GitHubClientOverride = &github.MockClient{...}. - Mock prompts: set
cfg.SelectFn,cfg.ConfirmFn, orcfg.InputFn. - Load stack files with
stack.Load(dir)after writing to get correct checksums.
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.
- yesterday 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,405 stars, last pushed 4d ago), licensed MIT. It adds 629 tokens to every session, about $0.0031 per session on Opus 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.
Other instructions, from other repositories
gh-infra CLAUDE.md
Instructions for babarot/gh-infra, covering claude.md, package responsibilities and package dependency rules.
gh-migrate CLAUDE.md
Instructions for HikaruEgashira/gh-migrate, a project described as: PR bulk creator :octocat.
github-mcp-server copilot-instructions.md
Instructions for github/github-mcp-server, covering github mcp server - copilot instructions, project overview, critical build & validation steps, required commands (run before committing) and when modifying mcp tools/endpoints.
av CLAUDE.md
Instructions for aviator-co/av, covering claude.md, project overview, documentation sources, command structure philosophy and development workflow.
vscode-gitlens AGENTS.md
AGENTS.md instructions for gitkraken/vscode-gitlens, covering gitlens development guide, working style expectations, development environment, development commands and git & repository guidelines.
ghtkn AGENTS.md
Instructions for suzuki-shunsuke/ghtkn, a project described as: A CLI to create short-lived (8 hours) GitHub App User Access Token for secure local development.