Skip to content

DOCS-1867 - Enforce Claude Code comment attribution with a hook - #7099

Draft
kimsauce wants to merge 1 commit into
mainfrom
DOCS-1867
Draft

DOCS-1867 - Enforce Claude Code comment attribution with a hook#7099
kimsauce wants to merge 1 commit into
mainfrom
DOCS-1867

Conversation

@kimsauce

@kimsauce kimsauce commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Purpose of this pull request

Every comment Claude Code posts is supposed to end with the via Claude Code attribution, but the AGENTS.md rule 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 a PreToolUse hook on Bash and the Jira comment MCP tool.
  • .claude/hooks/require-claude-attribution.sh (new) blocks gh pr comment, gh issue comment, gh pr review, gh api comment calls, and mcp__atlassian__addCommentToJiraIssue when the body does not contain via 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.md attribution 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 --approve with no body and non-comment Bash. No /docs content changed.

Select the type of change

  • Minor Changes - Typos, formatting, slight revisions
  • Update Content - Revisions, updating sections
  • New Content - New features, sections, pages, tutorials
  • Site and Tools - .clabot, version updates, maintenance, dependencies, new packages for the site (Docusaurus, Gatsby, React, etc.)

Ticket (if applicable)

https://sumologic.atlassian.net/browse/DOCS-1867

🤖 Generated with Claude Code

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>
@kimsauce kimsauce self-assigned this Sep 3, 2026
@cla-bot cla-bot Bot added the cla-signed Contributor approved, listed in .clabot file label Sep 3, 2026
@kimsauce
kimsauce marked this pull request as draft September 3, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed Contributor approved, listed in .clabot file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant