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/agents-mdgit 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.01925 | $0.01925 |
| Opus 5 | $0.00962 | $0.00962 |
| Sonnet 5 | $0.00385 | $0.00385 |
| Haiku 4.5 | $0.00193 | $0.00193 |
Grade A, and why
gh-stack AGENTS.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 — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.
gh-stack: Agent Instructions
A GitHub CLI (gh) extension for managing stacked branches and pull requests. Written in Go, it automates creating branches, keeping them rebased, setting PR base branches, and navigating between stack layers.
Build, test, and validate
go mod download # install dependencies
go build -o gh-stack . # build (produces ./gh-stack binary)
go vet ./... # static analysis. Run before tests.
go test -race -count=1 ./... # all tests with race detection
Always run go vet before go test. CI runs both on every push/PR across ubuntu, windows, and macOS (test.yml).
There is no Makefile, linter config, or code generation step. The standard Go toolchain is all that's needed.
Install locally as a gh extension
go build -o gh-stack .
gh extension remove stack 2>/dev/null
gh extension install .
Project structure
main.go # entrypoint. Calls cmd.Execute().
cmd/ # Cobra commands (one file per command + tests)
root.go # registers all subcommands in four groups
utils.go # shared helpers, ExitError types, exit codes
internal/
git/ # git.Ops interface + defaultOps (exec-based)
gitops.go # Ops interface (52 methods)
mock_ops.go # MockOps. Each method has a corresponding *Fn field.
github/ # github.ClientOps interface + real Client
client_interface.go # ClientOps interface (18 methods)
mock_client.go # MockClient. Uses function-pointer fields for testing.
stack/ # stack file (.git/gh-stack) management, JSON schema, locking
schema.json # JSON Schema for the stack file format
config/ # Config struct (I/O, colors, test overrides)
testing.go # NewTestConfig(). Returns *Config + stdout/stderr pipes.
branch/ # branch naming (Slugify, DateSlug)
modify/ # interactive stack modification state machine
pr/ # PR template discovery
tui/ # bubbletea/bubbles/lipgloss terminal UI
stackview/ # interactive stack visualization
modifyview/ # interactive modify session UI
shared/ # shared TUI types
docs/ # Astro + Starlight documentation site
skills/ # AI agent skill definition (SKILL.md)
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 · 138 lines · 1,925 tokens per session scan A 94c2e7ac9e52
gh-stack AGENTS.md is an instructions file published in the GitHub repository github/gh-stack (1,405 stars, last pushed 4d ago), licensed MIT. It adds 1,925 tokens to every session, about $0.0096 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.