Conversation
Add a PreToolUse hook that blocks any GitHub or Jira comment posted by Claude Code whose body is missing the "via Claude Code" attribution. Covers gh pr comment, gh issue comment, gh pr review, gh api comment calls, and the Jira addCommentToJiraIssue MCP tool. Broaden the AGENTS.md attribution rule to name GitHub PRs and issues, not just Jira, and point to the hook as the enforcement mechanism. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this pull request
Every comment Claude Code posts is supposed to end with the
via Claude Codeattribution, but theAGENTS.mdrule was scoped to Jira only and is a soft instruction, so GitHub PR and issue comments were attributed only intermittently.This PR makes it deterministic:
.claude/settings.json(new, team-wide) registers aPreToolUsehook onBashand the Jira comment MCP tool..claude/hooks/require-claude-attribution.sh(new) blocksgh pr comment,gh issue comment,gh pr review,gh apicomment calls, andmcp__atlassian__addCommentToJiraIssuewhen the body does not containvia Claude Code(case-insensitive), and tells Claude to repost with the marker. File-body (--body-file) calls pass through since the content is not visible; malformed hook input fails open.AGENTS.mdattribution rule broadened to cover GitHub PRs and issues, pointing at the hook as the enforcement mechanism.The hook is run by the Claude Code harness, not the model, so it fires every time.
Tested with 11 synthetic tool-call payloads: denies missing-marker GitHub and Jira comments, allows marked ones, ignores
gh pr review --approvewith no body and non-comment Bash. No/docscontent changed.Select the type of change
Ticket (if applicable)
https://sumologic.atlassian.net/browse/DOCS-1867
🤖 Generated with Claude Code