gh_close

A command for closing or reopening GitHub issues, which are tracked work items such as bugs and feature requests.

In plain words
What is it for?
Use it to close issues as completed, not planned, or duplicates, optionally adding a comment, or to reopen them.
Why use it?
It avoids ambiguous issue changes by checking issue titles, validating the arguments, and pausing when other open issues depend on one being closed.

Command

Install

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.

agentmods
npx agentmods add commands/blendsdk/claude-codeops/gh_close
Clone the repo
git clone --depth 1 https://github.com/blendsdk/claude-codeops
Per session 76 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,225 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00076 $0.01225
Opus 5 $0.00038 $0.00613
Sonnet 5 $0.00015 $0.00245
Haiku 4.5 $0.00008 $0.00122

Measured yesterday against content hash 20d53c7c215c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gh_close 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.

commands/gh_close.md · 84 lines

How it starts

The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.

gh_close — close or reopen GitHub issues by number

Close (or reopen) the listed issues using GitHub's native close-reason model, guarded by a title echo and a dependent-issue pause. This command mutates issues — it fires only when the user types it, never on the model's own initiative.

gh issue list and gh api graphql are in the allowlist solely for the read-only dependent lookup below — never use them for anything else, and never send GraphQL mutations.

Argument grammar

  • One or more issue numbers; 9 and #9 are equivalent (strip the #). Anything that is not numeric after stripping → reject the whole invocation with a usage line, before any mutation.
  • Reason flags are mutually exclusive: default completed, --not-planned (alias --wontfix), --duplicate <#N>. --reopen excludes all reason flags and --duplicate. Any conflicting combination → reject before any mutation.
  • --duplicate <#N> applies to EVERY listed issue (all become duplicates of #N). If #N itself is among the listed issues → error, nothing is closed.
  • --comment "…" combines with any close reason and with --reopen; its text is always passed as a quoted argument — never interpolated unquoted, never through eval.
  • --repo owner/repo targets another repo (default: the current directory's repo).

Preflight before touching anything: gh auth status — if gh is missing or unauthenticated, stop with an actionable hint (install: https://cli.github.com · authenticate: gh auth login).

Per-issue flow

For each issue number, in the order given:

  1. View & echo. gh issue view <n> → print Closing: <title> (#<n>) as <reason> (or Reopening: <title> (#<n>)). Nonexistent issue → clear error naming the number, then continue with the remaining issues.
  2. State check. Close mode on an already-closed issue → "already closed — skipping", no-op. Reopen mode on an already-open issue → "already open — skipping", no-op.
  3. Dependent guard (close modes only). Look up OPEN issues that depend on this one: a relation query (sub-issue / parent links) plus a search for body markers referencing it — Depends on #<n>, Blocked by #<n>, Depends: #<n>, case-insensitive. Open dependents found → list them and pause for the user's explicit confirmation before closing this issue; none found → proceed immediately. Lookup failure → degrade to the marker search only, say so, and proceed with the echo guard alone.
  4. Execute.
    • completed → gh issue close <n> --reason completed
    • not planned → gh issue close <n> --reason "not planned"
    • duplicate of #M → gh issue comment <n> --body "Duplicate of #M", then gh issue close <n> --reason "not planned" (emulation — see below)
    • reopen → gh issue reopen <n>
    • --comment rides on the action's own comment flag when the subcommand has one (gh issue close -c / gh issue reopen -c); otherwise post it as a separate gh issue comment immediately before the action.
  5. Record the outcome — closed / reopened / skipped / failed plus the reason.

Read the full file on GitHub · 84 lines

Changes

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.

  1. yesterday First seen · 84 lines · 76 tokens per session scan A 20d53c7c215c

Subscribe to this mod's changes

gh_close is a command published in the GitHub repository blendsdk/claude-codeops (4 stars, last pushed 1mo ago), licensed MIT. It adds 76 tokens to every session and 1,225 once invoked, about $0.0004 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-31.