Skip to content

feat: prepare-commit-msg hook for AI trailer enforcement #3

@Fieldnote-Echo

Description

@Fieldnote-Echo

Problem

Claude's training pipeline defaults to Co-Authored-By attribution in commits, overriding text rules that say otherwise. The current PreToolUse hooks block dangerous shell commands but have no mechanism to enforce commit message format or trailer conventions.

Proposal

Add a prepare-commit-msg git hook that:

  • Strips Co-Authored-By: Claude lines from commit messages
  • Appends the correct trailers (Coding-Agent:, Model:) if missing
  • Works in worktrees (hook path resolution must handle .git files, not just .git/ directories)

Scope

  • Hook install/uninstall via setup.sh
  • Tests for hook behavior (trailer insertion, stripping, worktree safety)
  • Configurable trailer values (not hardcoded to a specific model)

Context

Identified during PR #2 audit remediation — the "Generated with Claude Code" default kept leaking into PR bodies and commits despite explicit rules. Text rules reduce the problem; a hook eliminates it.

Coding-Agent: claude-code
Model: claude-opus-4-6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions