Skip to content

feat: detect AI disclosure in branch name - #78

Merged
omkar-foss merged 2 commits into
chaoss:mainfrom
Emirhankeles10:feat/detect-branch-name-disclosure
Aug 11, 2026
Merged

feat: detect AI disclosure in branch name#78
omkar-foss merged 2 commits into
chaoss:mainfrom
Emirhankeles10:feat/detect-branch-name-disclosure

Conversation

@Emirhankeles10

@Emirhankeles10 Emirhankeles10 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Description
Adds a branchname detector that flags branches created by AI coding CLIs/agents using their conventional prefixes (codex/, claude/, cursor/, copilot/, devin/, cline/, aider/, gemini/), matching the pattern noticed in chaoss/CollectOSS#397.

  • New detection.Input.BranchName field + GetBranchName() accessor
  • New gitops.GetCurrentBranch(repoPath) resolving the checked-out branch once per scan (empty string, no error, on detached HEAD)
  • New detection/branchname detector, registered alongside the existing detectors
  • Confidence: medium (naming convention, not proof, same tier as commit-message pattern matches)

This PR fixes #50

Notes for Reviewers

  • Verified locally: a repo with a commit on a codex/fix-typo branch is flagged (medium confidence), a normal feature/... branch is not.
  • go test ./... and go vet ./... pass.
  • Prefix list mirrors the tool names already used by the committer detector; happy to extend/adjust the prefix map if there are other conventions to cover.

Signed commits

  • Yes, I signed my commits.

Generative AI disclosure

Please select one option:

  • This contribution was NOT assisted or created by Generative AI tools.
  • This contribution was assisted or created by Generative AI tools.

If AI tools were used, please provide details below:

  • What tools were used? Claude (Claude Code)
  • How were these tools used? I asked Claude Code to find a good-first-issue in an active open-source project, and it picked this issue, read the existing detectors to follow the codebase's conventions, wrote the implementation (detector, gitops helper, wiring) and the tests, and drafted this PR description.
  • Did you review these outputs before submitting this PR? Yes: I watched it reproduce the current behavior first, reviewed the diff, and confirmed locally that go test ./... passes and that the CLI correctly flags a codex/* branch while leaving a normal branch untouched before opening this PR.

Add a branchname detector that flags branches created by AI coding
CLIs/agents using their conventional prefixes (codex/, claude/,
cursor/, copilot/, devin/, cline/, aider/, gemini/), following the
pattern noticed in chaoss/CollectOSS#397.

The current branch is resolved once per scan via a new
gitops.GetCurrentBranch and passed into detection.Input so all
commits in the scan share it. Detached HEAD (common in CI checkouts)
yields an empty branch name and no finding, rather than an error.

Refs chaoss#50

Signed-off-by: Emirhankeles10 <muhanmet_emirhan10@hotmail.com>

@omkar-foss omkar-foss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR looks good overall, could you also update the README to include this new detector?

@omkar-foss omkar-foss added enhancement New feature or request! detection-signal labels Aug 10, 2026
Signed-off-by: Emirhankeles10 <muhanmet_emirhan10@hotmail.com>

@omkar-foss omkar-foss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

README changes look good to me, thank you.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice first contribution, thanks for picking this up.

A couple of non-blocking notes for follow-up (not asking for changes here):

  • The branch name is resolved once and stamped on every commit in the range, so a 10-commit PR on codex/foo produces 10 identical branchname findings. Might be worth deduping at the report level or only emitting on the tip commit at some point.
  • The finding is tied to whatever branch is currently checked out rather than to the commits themselves, so ScanCommit on an arbitrary hash will flag it if you happen to be sitting on a codex/* branch, and it never fires under detached HEAD (most CI checkouts). Fine for the main use case of scanning a PR from its head branch, just something to keep in mind.
  • A few of the prefixes (claude/, aider/, cline/, gemini/) I'm less sure actually auto-create branches with that convention the way Codex/Cursor/Copilot/Devin do. Medium confidence covers it though, and we can trim the map later if any turn out to be noise.

@omkar-foss
omkar-foss merged commit 64cddd9 into chaoss:main Aug 11, 2026
4 checks passed
@MoralCode

Copy link
Copy Markdown
Contributor

I know I'm late to the party but it looks like this first contribution went smoothly, so congrats!

I'd love to invite you to join the CHAOSS Slack in the #data-ai-disclosure-detection channel if youre interested in chatting with us more or getting help finding your next contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Detect AI disclosure in branch name

5 participants