git/no-session-link
Severity: warning · Status: enforced · Applies to: repository-wide
What
A commit message should not contain a link to the coding-agent session that produced it, such as the trailer Claude Code adds:
Claude-Session: https://claude.ai/code/session_01AbCdEf...Why
Nobody else can open it. The session is private to whoever ran it, so reviewers following the link, and anyone reading the history later, reach a page that does not load.
A merged commit keeps it for good. History here is public and is not rewritten, so the link outlasts any reason it had to be there. A pull request description is a better place for it, if anywhere: it can be edited later.
What the link does not cover is how the change was made, and that is worth recording. A Co-Authored-By line naming the agent says so, as does an Assisted-by line in the style the Linux kernel uses. Neither is reported.
Wrong
my-project: add vocabulary redirect
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbCdEf...Right
my-project: add vocabulary redirect
Co-Authored-By: Claude <noreply@anthropic.com>Or:
my-project: add vocabulary redirect
Assisted-by: ClaudeHow to fix
The simplest way is to tick Please squash my commits when merging in the pull request description; the maintainer merging it can then leave the line out of the squashed message.
To remove it yourself, for the most recent commit:
git commit --amend # delete the line in the editor
git push --force-with-leaseFor an older commit, git rebase -i upstream/master, mark it reword, and delete the line; see git/minimal-commits for the same steps with a backup branch.
To stop Claude Code adding it, set attribution.sessionUrl to false in one of its settings files, such as ~/.claude/settings.json:
{
"attribution": {
"sessionUrl": false
}
}That keeps the Co-Authored-By line, and also leaves the link out of pull request descriptions. See the settings reference.
How to check
Run w3id-check with --rule git/no-session-link to check this rule on its own; without it the tool runs every rule, as the pull request checks do. This rule looks at your commits rather than your files, so it needs a base to compare against; narrowing it to a path would not change what it reports.
node tools/check/bin/w3id-check.js --rule git/no-session-linkTesting your changes covers installing the tool, and what else is worth checking by hand.