refactor(iterate-pr): move Claude Code attribution to script#107
Merged
Conversation
Move the '— Claude Code' attribution from the SKILL.md prompt instructions into the reply_to_thread.py script itself. The script now automatically appends the attribution if not already present, preventing duplicates and ensuring consistent attribution without requiring agents to manually add it. This addresses feedback from the team about attribution being automatically enforced rather than prompt-based. Co-Authored-By: Claude Code <https://cursor.com> Co-authored-by: Ivan Dlugos <vaind@users.noreply.github.com>
vaind
commented
Mar 25, 2026
| normalized = body.replace("\\r\\n", "\\n").replace("\\n", "\n") | ||
|
|
||
| # Add Claude Code attribution if not already present | ||
| attribution_variants = ["*— Claude Code*", "*- Claude Code*"] |
Contributor
Author
There was a problem hiding this comment.
Almost got me with the em dash —
There was a problem hiding this comment.
Just wondering if we should cover it replying with - Claude as well?
cameroncooke
approved these changes
Mar 25, 2026
cameroncooke
left a comment
There was a problem hiding this comment.
Looks good just a single comment
| normalized = body.replace("\\r\\n", "\\n").replace("\\n", "\n") | ||
|
|
||
| # Add Claude Code attribution if not already present | ||
| attribution_variants = ["*— Claude Code*", "*- Claude Code*"] |
There was a problem hiding this comment.
Just wondering if we should cover it replying with - Claude as well?
Replace hardcoded attribution variants with a regex pattern that matches any bot signature in the format '*— Bot Name*' or '*- Bot Name*' on the last line. This makes the script more flexible and allows it to detect signatures from any bot (Claude Code, Cursor, etc.) without needing to maintain a list of variants. Pattern: ^\*[—-]\s+.+\*$ - Matches both em-dash (—) and hyphen (-) - Requires at least one space after the dash - Matches any bot name - Only checks the last line of the message Co-Authored-By: Claude Code <https://cursor.com> Co-authored-by: Ivan Dlugos <vaind@users.noreply.github.com>
cameroncooke
approved these changes
Mar 25, 2026
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.
Summary
Moves the
*— Claude Code*attribution from the SKILL.md prompt instructions into thereply_to_thread.pyscript itself. The script now automatically appends the attribution if not already present, preventing duplicates and ensuring consistent attribution without requiring agents to manually add it.Changes
scripts/reply_to_thread.py:_normalize_body()to automatically append*— Claude Code*attribution if not already present^\*[—-]\s+.+\*$to detect any bot signature on the last line (supports both em-dash and hyphen variants)SKILL.md: Updated documentation to reflect that attribution is now automatic, removed manual attribution instructions from the promptMotivation
This addresses feedback about ensuring attribution is automatically enforced rather than prompt-based. By moving this logic into the script, we:
Testing
Verified the regex-based attribution logic handles:
\n\n*— Claude Code**— Claude Code*→ no change*- Claude Code*→ no change (preserves existing variant)*— Cursor*,*- Another Bot*) → no changeSlack Thread