Skip to content

feat(git): extend agent-provenance detection channels#731

Merged
RaghavChamadiya merged 1 commit into
mainfrom
feat/agent-provenance-detection
Jul 8, 2026
Merged

feat(git): extend agent-provenance detection channels#731
RaghavChamadiya merged 1 commit into
mainfrom
feat/agent-provenance-detection

Conversation

@RaghavChamadiya

Copy link
Copy Markdown
Member

What

Extends the deterministic agent-provenance classifier in the git indexer with three new AI-authorship detection channels. All are zero-LLM, local-history only, and layered onto the existing precision-first tier model without changing the shared commit-record format.

1. git-ai authorship notes (refs/notes/ai)

Reads the git-ai standard v3.0.0 authorship notes attached to commits. The note's sessions.<id>.agent_id.tool metadata resolves to the dominant agent for that commit (git_ai_note channel, tier 2). A tie between distinct tools stays unlabelled.

Read out of band via a ref-gated pass: repos without the ref do a single for-each-ref and add no git pass, so the common case pays nothing. Only repos that actually use git-ai walk the notes.

2. Assisted-by / Generated-by attribution trailers

Matches the Fedora/OpenInfra Assisted-by: and Apache Generated-by: commit trailers. The trailer key is a standardized AI marker, but the agent identity comes from the value, so these fire only when the value maps to a recognized agent. A bare human name in a misused trailer never mints a phantom agent. Generated-by is tier 2, Assisted-by tier 3.

3. Cursor commit-local markers + registry refresh

Adds the Cursor HTML-comment marker and "Generated with Cursor" footer, plus the gemini-code-assist bot login.

Validation

Ran the classifier over two real histories:

Repo Commits Attributed Notable
This repo (false-positive check) 569 5 (claude 4, copilot 1) all via genuine Co-authored-by; 0 git-ai notes; no false positives
git-ai project (true-positive) 4041 1652 (41%) 335 commits carry real ai notes; new git_ai_note channel attributes 326, the rest deferring correctly to higher-precedence bot-identity channels

Agent breakdown on the git-ai repo: claude 1286, devin 206, codex 107, copilot 29, cursor 24. Note tools present: codex 107, claude 196, devin 11, cursor 21.

Tests

Adds coverage for the note parser (single tool, alias mapping, dominant-tool, tie ambiguity, malformed input), the two trailer channels, the bare-human-name precision guard, Cursor markers, tier precedence, and the ref-gated notes loader (absent ref never spawns the walk). Full git-indexer suites pass.

Add three deterministic AI-authorship channels to the git indexer, all
zero-LLM and local-history only, layered onto the existing precision-first
classifier without changing the shared commit-record format.

- git-ai authorship notes (refs/notes/ai, git-ai standard v3.0.0): read
  out of band via a ref-gated pass, so the 99.9% of repos without the ref
  do a single for-each-ref and add no git pass; only repos actually using
  git-ai walk the notes. Each note resolves to the dominant agent for that
  commit (git_ai_note channel, tier 2). A tie between tools stays
  unlabelled.
- Assisted-by / Generated-by attribution trailers (Fedora/OpenInfra and
  Apache standards): fire only when the value maps to a recognized agent,
  so a bare human name in a misused trailer never mints a phantom agent.
  Generated-by is tier 2, Assisted-by tier 3.
- Cursor commit-local markers (HTML comment, "Generated with Cursor") and
  the gemini-code-assist bot login.

Validated on the git-ai project's own history: 335 commits carry real
ai notes (codex/claude/devin/cursor) and the new channel attributes them
correctly, with no false positives on a repo that carries none.
@RaghavChamadiya RaghavChamadiya requested a review from swati510 as a code owner July 8, 2026 11:36
@repowise-bot

repowise-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

✅ Health: 7.7 (unchanged)

📋 At a glance
1 file changed health · 3 hotspots touched · 5 new findings introduced · 5 co-change pairs left out.

Files & modules (2)
  • packages (2 files)
    • .../git_indexer/agent_provenance.py
    • .../ingestion/git_commit_index.py
  • tests (1 file)
    • .../ingestion/test_agent_provenance.py

⚠️ Change risk: moderate (riskier than 51% of this repo's commits · raw 9.0/10)
This change's risk is driven by:

  • more lines added than baseline
  • more scattered than baseline
File Score Δ Why
.../git_indexer/agent_provenance.py 6.9 → 6.4 ▼ -0.5 🔻 introduced complex method, bumpy road, error handling

💡 .../git_indexer/agent_provenance.py: Reduce cyclomatic complexity. Decompose the function along its conditional axes; if it dispatches on a type tag, replace the if/elif ladder with polymorphism or a lookup table.

🔎 More signals (2)

🔥 Hotspots touched (3)

  • .../git_indexer/agent_provenance.py — 1 commits/90d, 4 dependents · primary owner: Raghav Chamadiya (100%)
  • .../ingestion/test_agent_provenance.py — 1 commits/90d, 0 dependents · primary owner: Raghav Chamadiya (100%)
  • .../ingestion/git_commit_index.py — 6 commits/90d, 5 dependents · primary owner: Raghav Chamadiya (100%)

🔗 Hidden coupling (1 file)

  • .../ingestion/git_commit_index.py co-changes with these files (not in this PR):
    • .../git_indexer/indexer.py (3× — 🟢 routine)
    • .../git_indexer/records.py (3× — 🟢 routine)
    • .../persistence/models.py (3× — 🟢 routine)
    • .../git_indexer/commit_rows.py (2× — 🟢 routine)
    • tests/unit/test_git_commit_rows.py (2× — 🟢 routine)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-08 11:37 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya RaghavChamadiya merged commit 8a3150f into main Jul 8, 2026
4 of 7 checks passed
@RaghavChamadiya RaghavChamadiya deleted the feat/agent-provenance-detection branch July 8, 2026 11:57
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.

2 participants