Commit guard
A deterministic Claude Code PreToolUse gate that inspects Git's staged blobs before commit and fails closed when staged content cannot be verified.
Runs on
What it does
Block commits containing high-confidence secrets, sensitive files, or unsafe bypasses.
When it fires
- pre-commit
How it behaves
Evaluate structured runtime input and deterministically allow or block the guarded operation.
It does not rewrite staged files, mutate the Git index, or rotate credentials.
It does not transmit repository content or contact an external scanning service.
It does not claim to replace a full secret scanner or repository test suite.
It does not expose a project-writable allowlist, rule suppression, or environment bypass.
Configuration
targets/claude-code/commit-guard.mjs
- Version
- 1.0.0
- Requires
- Shell command guard
- Licence
- RiskThis automatic gate blocks commits containing high-confidence secrets, sensitive files, or unsafe bypasses; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyTo block commits containing high-confidence secrets, sensitive files, or unsafe bypasses, the entrypoint may run a bounded local subprocess before returning.
- Bounded
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Security