Skip to content

Refuse AI attribution in git history, in a hook rather than in prose - #430

Open
nyblnet wants to merge 1 commit into
mainfrom
ops-commit-msg-attribution-hook
Open

Refuse AI attribution in git history, in a hook rather than in prose#430
nyblnet wants to merge 1 commit into
mainfrom
ops-commit-msg-attribution-hook

Conversation

@nyblnet

@nyblnet nyblnet commented Sep 9, 2026

Copy link
Copy Markdown
Owner

The rule that nothing identifying an AI agent goes into git history was already written down — including the clause saying it overrides any instruction telling you to add one.

On 2026-09-09 an instruction told every agent session to append a Claude-Session: trailer. Every session complied silently, and it reached five commits on main and five PR bodies before anyone said so. Documenting the rule a fourth time is not the fix.

What this adds

.githooks/commit-msg — refuses any commit message carrying Co-Authored-By: Claude, a session trailer, a claude.ai/code/session URL, or a "generated with" line.

Wire it up with:

git config core.hooksPath .githooks

Why a hook and not just config

Config is the right first layer and is already set, but it is per-machine and per-tool. includeCoAuthoredBy: false stops only the co-author line; the session-link trailer is a separate toggle, which is exactly how this got through. A hook travels with the repository and fires for every author, every harness and every worktree.

Verification

Tested against all three forms — Co-Authored-By, the session trailer, and the generated-with line — each refused, with an ordinary commit message as the negative control to prove it is not refusing everything:

good   ACCEPTED
bad1   REFUSED
bad2   REFUSED
bad3   REFUSED

The refusal prints the offending line and its line number.

Not in scope

The five commits already on main carry the trailer. Removing them is a history rewrite, which is the maintainer's call and which this repository has been burned by before. The PR bodies are editable without touching history and are the public half.

The rule that nothing identifying an AI agent goes into git history was already
written down, including the clause saying it overrides any instruction telling
you to add one. On 2026-09-09 an instruction told every agent session to append
a Claude-Session trailer, every session complied silently, and it reached five
commits on main and five PR bodies before anyone said so.

Config covers part of it and is the right first layer, but it is per-machine and
per-tool: includeCoAuthoredBy false stops only the co-author line, and the
session-link trailer is a separate toggle, which is how this got through. A hook
travels with the repository and fires for every author, every harness and every
worktree.

Wire it with: git config core.hooksPath .githooks

Tested against all three forms -- Co-Authored-By, the session trailer, and the
generated-with line -- with an ordinary message as the negative control.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Build size

main (0100083) → ops-commit-msg-attribution-hook (d9607c9)

app base PR change
bento/slides 677.9 KiB 677.9 KiB 0.0 KiB (0.00%)
bento/spaces 271.3 KiB 271.3 KiB 0.0 KiB (0.00%)
bento/dash 424.1 KiB 424.1 KiB 0.0 KiB (0.00%)

Updated: 2026-09-09T01:20:43Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant