grant-commit

A command that grants temporary or workflow-specific consent for Claude to run a Git commit. Git is a tool that records changes to code, and the consent is stored in a project state file for a commit guard to check.

In plain words
What is it for?
Authorizing the next Git commit, or commits within the active workflow, when the Git Commit Guard requires explicit consent.
Why use it?
It allows the repository’s commit-protection hook to distinguish an approved commit from an unapproved one. The grant is tied to the active workflow when one exists, or otherwise uses a limited time window.

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/friedbotstudio/baseline/grant-commit
Clone the repo
git clone --depth 1 https://github.com/friedbotstudio/baseline

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 1,117 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.01117
Opus 5 $0.00016 $0.00558
Sonnet 5 $0.00006 $0.00223
Haiku 4.5 $0.00003 $0.00112

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

Security

Grade A, and why

grant-commit 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/grant-commit.md · 26 lines

How it starts

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

Write a consent token to .claude/state/commit_consent so the Git Commit Guard hook allows the next git commit. The token has three lines: line 1 the active workflow slug (empty when no workflow is active), line 2 the current UNIX epoch, line 3 any optional note.

Workflow-scoped consent, with a time-window fallback. When a workflow is active (.claude/state/workflow.json present), the token is bound to that workflow's slug: the guard allows commits only while the live workflow slug matches, so one grant authorizes every commit in that workflow's landing and only that workflow. When no workflow is active, the token carries an empty slug and the guard falls back to the classic 900s time window — an ad-hoc commit still requires this fresh, human-granted consent. A workflow.json that is present but unreadable fails closed.

How this works structurally: when the user typed /grant-commit, the consent_gate_grant UserPromptSubmit hook ran before this body was passed to Claude and wrote a short-lived consent marker at .claude/state/.commit_consent_grant (carrying the workflow slug it read from workflow.json). The git_commit_guard PreToolUse hook (Write matcher) reads that marker and allows Claude to write the consent file only while the marker is fresh and its slug matches the live workflow. Claude cannot forge the marker — that's what makes the gate structural. The Bash-matcher leg of the same guard then enforces the consent token on the actual git commit invocation.

State-write discipline (binding — see .claude/CONSTITUTION.md §2 "State-write discipline"). The consent token at .claude/state/commit_consent is a Tier 1 consent artifact: it SHALL be written with the Write tool only. You SHALL NOT write it via Bash (no >/>> redirect, heredoc, tee, cp, or sed -i) — destructive_cmd_guard blocks Bash writes to consent paths, and the git_commit_guard Write matcher validates the marker only on the Write tool. Use Bash solely for the prechecks below (git rev-parse) and to compute the epoch (date +%s).

Steps:

  1. Git-repo precheck. Run git rev-parse --is-inside-work-tree 2>/dev/null. If the exit status is non-zero, this project is not a git repository: refuse to write the consent token and tell the user "Not a git repository — /grant-commit is inapplicable. Per CLAUDE.md Article IV, gate C and commit are auto-excepted on non-git projects; the workflow ends after /archive. Persistence outside git is your responsibility." Stop here.
  2. Pending memory advisory (non-blocking). Count ## CANDIDATE: blocks in .claude/memory/_pending.md. If the count is > 0, surface a one-line advisory to the user before writing the consent token: "Pending memory: candidate(s) in .claude/memory/_pending.md — run /memory-sync if relevant, or proceed with git commit (memory is harness-local; this never blocks)." If 0, no advisory. The token is written regardless.
  3. Resolve the workflow slug. Read .claude/state/workflow.json if it exists and take its slug field. If the file is absent, use an empty slug (ad-hoc commit → time-window fallback). Do not invent a slug and do not accept one from $ARGUMENTS — the slug comes only from workflow.json.
  4. Run date +%s to get the current epoch.
  5. Write the consent token with the Write tool, overwriting any prior token: line 1 the workflow slug from step 3 (an empty line when there is no active workflow), line 2 the epoch, line 3 the optional note $ARGUMENTS (omit if empty), to .claude/state/commit_consent. Do not use a Bash redirect or tee — that path is guard-blocked.
  6. Confirm to the user: when a workflow was active, "Commit consent granted for workflow <slug> at . One grant covers every commit in this workflow's landing (900s TTL)."; when none was active, "Commit consent granted at , valid for 900s (until <HH:MM:SS local>) — no active workflow, so this is a time-window grant." In both cases add: "Forbidden flags (push, --amend, --no-verify, reset --hard, etc.) remain blocked regardless." (/grant-push is a separate 300s window for pushes.)

Read the full file on GitHub · 26 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 · 26 lines · 32 tokens per session scan A 766c57a5f97c

Subscribe to this mod's changes

grant-commit is a command published in the GitHub repository friedbotstudio/baseline (11 stars, last pushed 5d ago), licensed Apache-2.0. It adds 32 tokens to every session and 1,117 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.