diff --git a/memory/2026-02-27-block-co-authored-by-attribution-hook-implementati.md b/memory/2026-02-27-block-co-authored-by-attribution-hook-implementati.md new file mode 100644 index 000000000..97868106d --- /dev/null +++ b/memory/2026-02-27-block-co-authored-by-attribution-hook-implementati.md @@ -0,0 +1,19 @@ +# 2026-02-27 Session Notes + +## Block Co-Authored-By Attribution Hook Implementation + +Nicholai requested implementation of a PreToolUse hook to block any git commits that contain Claude Code's automatic "Co-Authored-By: Claude" attribution. The session involved planning and beginning implementation of the blocking mechanism. + +## Technical Approach + +The solution uses a bash script (`~/.claude/hooks/block-coauthor.sh`) that intercepts Bash tool calls before execution. The hook reads JSON input via stdin, extracts the git command being run using `jq`, and scans for the case-insensitive pattern `Co-Authored-By:.*Claude`. If found, it outputs a JSON response with `permissionDecision: "deny"`; otherwise it exits cleanly to allow execution. + +The PreToolUse hook is registered in `~/.claude/settings.json` with a 5-second timeout and matcher targeting the Bash tool. + +## Work Completed + +Read existing `settings.json` to understand the hook structure and confirm the format for adding new hook entries. The file contains existing SessionStart, UserPromptSubmit, and SessionEnd hooks that call signet commands. + +## Next Steps + +Create the bash script and update settings.json to register the PreToolUse hook. Test by attempting a commit through Claude Code (should be blocked) and a manual git commit outside Claude (should work normally). \ No newline at end of file diff --git a/memory/memories.db b/memory/memories.db index 9a69f18f7..7603ab394 100644 Binary files a/memory/memories.db and b/memory/memories.db differ diff --git a/memory/memories.db-shm b/memory/memories.db-shm index 598d272c9..be7737fd4 100644 Binary files a/memory/memories.db-shm and b/memory/memories.db-shm differ diff --git a/memory/memories.db-wal b/memory/memories.db-wal index 686309be4..4bf69eab2 100644 Binary files a/memory/memories.db-wal and b/memory/memories.db-wal differ