Skip to content

refactor(iterate-pr): move Claude Code attribution to script#107

Merged
vaind merged 2 commits intomainfrom
cursor/iterate-pr-attribution-script-70d7
Mar 25, 2026
Merged

refactor(iterate-pr): move Claude Code attribution to script#107
vaind merged 2 commits intomainfrom
cursor/iterate-pr-attribution-script-70d7

Conversation

@vaind
Copy link
Copy Markdown
Contributor

@vaind vaind commented Mar 25, 2026

Summary

Moves 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.

Changes

  • scripts/reply_to_thread.py:
    • Enhanced _normalize_body() to automatically append *— Claude Code* attribution if not already present
    • Uses regex pattern ^\*[—-]\s+.+\*$ to detect any bot signature on the last line (supports both em-dash and hyphen variants)
    • Detects signatures from any bot (Claude Code, Cursor, etc.) without maintaining a hardcoded list
  • SKILL.md: Updated documentation to reflect that attribution is now automatic, removed manual attribution instructions from the prompt

Motivation

This addresses feedback about ensuring attribution is automatically enforced rather than prompt-based. By moving this logic into the script, we:

  • Ensure consistent attribution on all replies
  • Prevent agents from forgetting to add attribution
  • Reduce prompt complexity
  • Make attribution enforcement more reliable
  • Support any bot signature format without code changes

Testing

Verified the regex-based attribution logic handles:

  • Messages without attribution → adds \n\n*— Claude Code*
  • Messages with *— Claude Code* → no change
  • Messages with *- Claude Code* → no change (preserves existing variant)
  • Messages with other bot signatures (*— Cursor*, *- Another Bot*) → no change
  • Multi-line messages → proper spacing before attribution
  • Bot signatures in the middle of text → adds attribution (only checks last line)

Slack Thread

Open in Web Open in Cursor 

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>
normalized = body.replace("\\r\\n", "\\n").replace("\\n", "\n")

# Add Claude Code attribution if not already present
attribution_variants = ["*— Claude Code*", "*- Claude Code*"]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost got me with the em dash —

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if we should cover it replying with - Claude as well?

@vaind vaind marked this pull request as ready for review March 25, 2026 13:38
@vaind vaind requested a review from cameroncooke March 25, 2026 13:38
Copy link
Copy Markdown

@cameroncooke cameroncooke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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*"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@vaind vaind requested a review from cameroncooke March 25, 2026 14:13
@vaind vaind merged commit 07ec616 into main Mar 25, 2026
12 checks passed
@vaind vaind deleted the cursor/iterate-pr-attribution-script-70d7 branch March 25, 2026 18:03
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.

3 participants