
What happened
With no guard, Claude Code produced single commits of 298 and 426 lines; the pre-commit hook split both runs into six commits (max 76 and 80 lines) and refused the over-limit first attempt.
Why it matters
A hard external check reliably kept each commit small, whereas a soft written instruction only set the default habit and lost when a direct request conflicted.
Summaries like this, every morning.
By signing up you agree to the Terms of Service and Privacy Policy.
The test set up a repository with five identical modules under src/ and asked Claude Code to add input validation, error handling, and node:test tests to all of them, then commit once npm test passed. Two guard mechanisms were compared: a CLAUDE.md rule capping each commit at 100 changed lines, and a git pre-commit hook that rejects any commit over that limit. Without either guard, the first attempt landed as a single 298-line commit and the second as a 426-line commit.
The difference showed up when the request itself changed. With the written CLAUDE.md instruction, Claude Code split the work into six commits by default, but when the prompt explicitly said to put everything into one commit, one run produced a 139-line commit and explained that it prioritized the direct instruction. The pre-commit hook, by contrast, rejected the initial bulk commit in both runs and Claude Code then re-split the work on its own; when told to make one commit, it stopped without committing and asked the user to decide, and it never used --no-verify to bypass the check. The hook is an external check outside Claude Code's own settings, so it does not depend on the model following a written rule.
Even with smaller commits, the total diff for the pull request stayed in the 304–427 line range, unchanged from the no-guard runs. Shrinking the PR itself would require a smaller initial request, a pre-push hook measuring the diff against main, or a CI check on PR size; none of those were tested. The author also notes each condition was run only twice on an easily divisible subject, so results could differ for changes that are hard to split, such as a large rewrite of a single file.
Pick your industry and the AI tools you use, and get news related to your work every day.
By signing up you agree to the Terms of Service and Privacy Policy.
Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →
Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.
altspark Inc., a Pittsburgh-based startup, launched a hosted platform that connects apps, databases and docume…
ASUS announced the XA P8N-E2X at NVIDIA GTC Washington, D.C

Ruining He and co-authors at Google Research proposed RealFormer, which adds residual connections to attention…

Ben's Bites compares today's AI adoption to learning to Google in 1998 — it took about ten years for search ha…

In McKinsey's August 2026 survey, 40% of respondents at organizations with more than $1 billion in annual reve…

Cisco's Outshift released open-source tools ACCORD, CONCORD, SCOPE, and MAS-Lab
