Repository navigation
tools: add commit-cleaner to strip Claude attribution from commits - #12
Merged
Merged
Conversation
Adds a commit-msg hook that removes Co-Authored-By: Claude and Claude-Session trailers, an installer (per-repo or global), a Claude Code PreToolUse guard against --no-verify and hooksPath bypasses, a dry-run-by-default git filter-repo wrapper for existing commits, tests, and a workflow that runs them.
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
Claude Code appends
Co-Authored-By: Claude … <noreply@anthropic.com>andClaude-Session: …trailers to every commit it makes. This adds a shared toolkit undertools/commit-cleaner/that strips them at commit time, stops the hook being bypassed from inside a Claude Code session, and can scrub commits that already carry them. Reimplements the approach fromya8282/commit-cleaner-hookin-house so the foundation's repositories don't depend on a third-party plugin.Changes
commit-msg: POSIXcommit-msghook. Removes ClaudeCo-Authored-By,Claude-Session,Generated with [Claude Code]and bare session-URL lines; keeps human co-author trailers; leaves a clean message byte-identical; never blocks a commit on error.install.sh: installs per repository (honourscore.hooksPathand worktrees) or globally via~/.config/git/hooks; chains an existing foreign hook and restores it on--uninstall.guard.py: Claude CodePreToolUsehook that refusesgit commit --no-verify,-n(including flag clusters),core.hooksPathoverrides,HOME/GIT_DIRrelocation, edits to the hook file, and one layer ofbash -c/eval/$(…)wrapping.clean-history.sh: dry-run-by-defaultgit filter-repo --message-callbackwrapper for existing commits, with clean-tree and range checks.claude-settings.example.json: drop-in.claude/settings.jsonfor repositories that vendor the hook under.githooks/.test.shplus.github/workflows/commit-cleaner-tests.yml: 26 tests covering message rewriting, a real repository, hook chaining,core.hooksPath, and guard allow/block cases. The workflow runs only when the tool changes and pinsactions/checkoutto the same SHA as the existing workflows.README.mddocumenting the three install options, history scrubbing, and limits.How tested
tools/commit-cleaner/test.shpasses locally (26/26). The hook was also installed into this clone before committing: this PR's own commit was made by Claude Code with the trailers attached, and they were stripped.Companion PRs vendor the hook into
beanstalkanddocassemble.🤖 Generated with Claude Code
https://claude.ai/code/session_01MU3XgW95kXzx2SHkKwPW32
Generated by Claude Code