.agents/memory/2026-02-27-claude-code-attribution-hook.md

1014 B

2026-02-27 Session Notes

Claude Code Attribution Hook

Initiated implementation of a PreToolUse hook to block git commits containing Claude Code's automatic "Co-Authored-By: Claude noreply@anthropic.com" attribution. The plan involves two tasks:

  1. Hook Script Creation - A bash script at ~/.claude/hooks/block-coauthor.sh that reads JSON from stdin, extracts the command via jq, checks for git commit operations, and scans for the Co-Authored-By pattern (case-insensitive). Denies execution if found, allows otherwise.

  2. Settings Registration - Adding a PreToolUse entry to ~/.claude/settings.json hooks object with matcher "Bash", 5-second timeout, and status message.

Examined existing settings.json structure which already has hooks configured for SessionStart, UserPromptSubmit, and SessionEnd via signet commands. The PreToolUse hook will follow the same pattern structure.

Session ended after reading settings.json; implementation of the hook script and settings update pending.