fix: use git diff --stat in commit-commands to avoid context bloat#58842
Open
daniel769 wants to merge 1 commit into
Open
fix: use git diff --stat in commit-commands to avoid context bloat#58842daniel769 wants to merge 1 commit into
daniel769 wants to merge 1 commit into
Conversation
Replace `git diff HEAD` with `git diff HEAD --stat` in both commit.md and commit-push-pr.md. The full unified diff was loading into Claude's context on every invocation, bloating sessions by 700KB+ on large commits (e.g. SQL regen with 50+ auto-generated files). The --stat summary is sufficient for generating a commit message; full per-file diffs can be fetched on demand if needed. Fixes anthropics#58372 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
!`git diff HEAD`with!`git diff HEAD --stat`inplugins/commit-commands/commands/commit.mdandplugins/commit-commands/commands/commit-push-pr.md/commitor/commit-push-prinvocation--statsummary (file names + insertion/deletion counts) is sufficient for generating a commit message; full per-file diffs can be fetched on demand if neededFixes #58372
Test plan
/commiton a repo with a small diff — stat summary appears in context, commit message is generated correctly/commiton a repo with a large diff (many files) — context stays small, no 700KB+ injection/commit-push-pr— same behaviour, PR is created successfully🤖 Generated with Claude Code