Skip to content
youdede

Large diff review guard

OperationsHookv1.0.0

A deterministic Claude Code PreToolUse gate for git commit that measures the file count, text additions and deletions, and binary size the commit will take (the staged snapshot, or an upper bound against HEAD when the command stages or commits working-tree content), then blocks changes above explicit fixed reviewability limits.

Runs on

Scope
$npx @youdede/toolkit add large-diff-review-guard --target claude-code

What it does

Require a smaller staged change when a commit exceeds bounded reviewability thresholds.

When it fires

  • pre-commit
  • review

How it behaves

Measure the staged Git change and reject commits that exceed deterministic reviewability budgets.

It does not split, edit, stage, unstage, commit, summarize, review, or approve the change.

It does not claim that a small diff is correct or that a large diff is necessarily unsafe.

It does not count unstaged work that the commit will not take, or generated impact outside the commit.

It does not accept repository configuration, commit flags, or prompt text as a bypass.

Configuration

targets/claude-code/large-diff-review-guard.mjsnode · read-only

Version
1.0.0
Requires
Shell command guard
Licence
RiskThis automatic gate requires a smaller staged change when a commit exceeds bounded reviewability thresholds; 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 require a smaller staged change when a commit exceeds bounded reviewability thresholds, the entrypoint may run a bounded local subprocess before returning.
Bounded
Data retentionWhether data remains after use and who manages its storage.
Not retained
In packs
  • Daily driver
  • Reviewable change

Often used with

All in Operations