speckit-gaia-spec-close

A command that closes a completed SPEC, meaning a documented software change, after its implementation pull request has been merged. It can finish deferred documentation work and clean up the SPEC's local files.

In plain words
What is it for?
Use it to close a named SPEC, process pending wiki updates, record the merge in SUMMARY.md and cost.jsonl, and remove its local working folder.
Why use it?
It removes leftover project records only after the merge and related documentation work are accounted for.

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/gaia-react/gaia/spec-close
Clone the repo
git clone --depth 1 https://github.com/gaia-react/gaia
Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,000 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.00054 $0.02000
Opus 5 $0.00027 $0.01000
Sonnet 5 $0.00011 $0.00400
Haiku 4.5 $0.00005 $0.00200

Measured 2d ago against content hash b4fd43d57e8b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

speckit-gaia-spec-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 2d 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.

.specify/extensions/gaia/commands/spec-close.md · 112 lines

How it starts

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

Spec Close, Lifecycle

Closes a SPEC after its implementing PR has merged. Two responsibilities:

  1. Drain a deferred wiki-promote, if /speckit-implement saw the PR unmerged and cached a defer flag.
  2. Cold-consolidate and reap the local SPEC folder, once the wiki side is settled and the ledger records the merge.

Auto-triggered from wiki-promote Step 8 on the immediate-merge path. Also invokable manually as /speckit-gaia-spec-close [SPEC-NNN] for the deferred path or for retroactive cleanup.

Step 1: Resolve target SPEC

If $ARGUMENTS matches SPEC-NNN, target that SPEC.

Otherwise, build the candidate list:

  1. Caches (deferred-drain candidates): ls .gaia/local/cache/wiki-promote/*.json 2>/dev/null → SPEC IDs awaiting drain.
  2. Specs (in-flight or pending disposition): ls -d .gaia/local/specs/SPEC-*/ 2>/dev/null → SPEC IDs from folder names (excludes archived/).

If exactly one candidate exists, default to it. If multiple, surface via AskUserQuestion:

  • Question: Multiple SPECs eligible for close. Which one?
  • Header: SPEC close
  • Options: one per candidate, labeled <spec_id>, <intent first line> with description noting (awaiting drain) if the cache exists.

If no candidates: report spec-close: no SPECs to close. and exit.

Step 2: Conditional drain

Test for .gaia/local/cache/wiki-promote/<spec_id>.json.

If the cache exists (deferred path):

  1. Read the cache. Run gh pr list --head "$branch" --state merged --json number,mergedAt,url,body --limit 1.
  2. If still unmerged: report <spec_id>: PR for branch <branch> not yet merged. Re-run after merge. and exit. Do not delete the cache. Do not proceed to disposition, the SPEC is not closed yet.
  3. If merged: re-invoke /speckit-gaia-wiki-promote by calling the Skill tool to run that command with the SPEC ID as its argument, and include the exact literal string drained: true in the invoking message. Wiki-promote's Step 3 detects the merged PR, runs Steps 4–7, and deletes the cache. Wiki-promote's Step 8 chain is suppressed in this drain context to avoid re-entering spec-close: its Step 8 suppression guard matches that literal drained: true token in the invocation, so emit it verbatim, not a paraphrase, and do not rely on the surrounding conversation to convey it (see wiki-promote Step 8 for the guard).

Read the full file on GitHub · 112 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. 2d ago First seen · 112 lines · 54 tokens per session scan A b4fd43d57e8b

Subscribe to this mod's changes

speckit-gaia-spec-close is a command published in the GitHub repository gaia-react/gaia (22 stars, last pushed 2d ago), licensed MIT. It adds 54 tokens to every session and 2,000 once invoked, about $0.0003 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.