gate

A checkpoint for SDD projects that checks policy, approval, and consistency before implementation. SDD is a workflow where software is planned in specifications before code is written.

In plain words
What is it for?
Use it to run the project's SDD policy and gate checks, report warnings and errors, record user consent, and prepare implementation only when an approved specification is present.
Why use it?
It shows whether work is approved, still waiting for approval, or blocked by errors. It also states what was checked, so a passing result is not mistaken for proof that the code matches the specification.

Command for Claude Code

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/juanklagos/spec-driven-development-template/gate
Clone the repo
git clone --depth 1 https://github.com/juanklagos/spec-driven-development-template

Made for: Claude Code.

Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 719 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.00032 $0.00719
Opus 5 $0.00016 $0.00360
Sonnet 5 $0.00006 $0.00144
Haiku 4.5 $0.00003 $0.00072

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

Security

Grade A, and why

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

.claude/commands/sdd/gate.md · 31 lines

What it actually says

Run the gate and, only if it opens, prepare implementation. Respond in the user's language (EN/ES).

  1. Run (root layout; in sidecar projects use ./spec/scripts/...):
    • ./scripts/check-sdd-policy.sh .
    • ./scripts/check-sdd-gate.sh .
  2. Report the result honestly, including full error/warning lines, the verdict line and the posture line. The gate answers one of three states, and they mean different things:
    • open / ABIERTA — a spec is approved and consented to. Implementation may start.
    • closed / CERRADA — nothing is approved yet. Not a failure: it is where every project starts. Exit code is still 0 unless --require-open was passed, in which case it is 2.
    • blocked / BLOQUEADA — there are errors. Exit code 1. The posture line states what the gate did and did NOT check. Repeat it to the user rather than paraphrasing: it is the only thing standing between a green result and a false sense of coverage. In particular the gate does not read project code, so it cannot tell you whether what was written matches the spec.
  3. If the gate FAILS, branch on which error it printed. Do not implement either way.
    • Only missing consent (Missing or empty user consent log and/or NNN-slug approved but no user consent recorded for it) — the spec itself is fine, it just has no recorded consent yet. /sdd:spec cannot fix this; consent is the remedy. So:
      • Ask the user explicitly: "Do you approve starting implementation of spec NNN with this scope?"
      • Only after a clear yes in the chat, record it: ./scripts/confirm-user-consent.sh --spec NNN-slug "User approved implementation for spec NNN-slug".
      • Re-run ./scripts/check-sdd-gate.sh . and continue from step 2 with the new result.
    • Any other error (spec not approved, placeholder approval date/approver, empty approval evidence, plan.md incomplete, tasks.md with no checklist, a missing agent rule file) — name the exact gap and the file/section to fix, and suggest /sdd:spec to refine. Never record consent to make one of these go away.
  4. If the gate PASSES:
    • If consent for the active spec is already recorded, implementation may start, limited to the tasks in tasks.md of that spec.
    • If the gate only passed because a legacy workspace-wide consent log covers the spec (the Legacy consent log covers these approved specs warning), ask for approval as in step 3 and record a per-spec entry before implementing.

Notes:

  • Consent is per spec. One recorded consent opens the gate for that spec id only.
  • A consent entry without --spec is a legacy, workspace-wide record: the gate accepts it with a warning, but prefer the explicit form.

Hard stop: no code before approved spec.md, consistent plan.md, and recorded consent for that spec. Never fabricate or assume consent.

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 · 31 lines · 32 tokens per session scan A 03c11aea97cc

Subscribe to this mod's changes

gate is a command published in the GitHub repository juanklagos/spec-driven-development-template (14 stars, last pushed yesterday), licensed MIT. It adds 32 tokens to every session and 719 once invoked, about $0.0002 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.