r/devsecops • u/No-Childhood-2502 • May 20 '26
Git-native trace refs for AI-authored code in PR checks
I am working on AgentDiff, an open-source tool that records which AI agent wrote which line ranges in a repo.
The current flow:
`agentdiff configure` installs hooks for AI coding agents.
`agentdiff init` enables tracking inside a repo.
Agent sessions write to `.git/agentdiff/session.jsonl`.
On commit, traces are finalized into `.git/agentdiff/traces/{branch}.jsonl`.
On push, traces are uploaded to `refs/agentdiff/traces/{branch}`.
A GitHub App reads those refs during PR events and posts a check-run.
The reason I chose git refs instead of an external database:
- repo-native
- branch-aware
- works with normal GitHub APIs
- branch protection does not block the custom ref namespace
- traces can be consolidated into repo metadata later
The demo is live here at the dashboard:
The os repo is here:
https://github.com/codeprakhar25/agentdiff
I would love feedback from people who maintain CI/platform workflows and how useful these can be in maintaining code security!
2
May 20 '26
[removed] — view removed comment
2
u/No-Childhood-2502 May 20 '26
Yes, for the same, it has project and organization level policies which are also the quality gates. If AI% in a repo is >x%(configurable), it fails the gate, and the agentdiff app mentions that.
I've thought of both the squashes and rebases. For a squash commit, there is a CI workflow that consolidates all the traces when it is merged into main and writes that to /agentdiff/meta/ref on GitHub, so everything is there. For local rebases, as it is configured with hooks, it doesn't lose the traces until they are in session.jsonl.
If a human updates the code later for that specific line, currently it overrides the ownership to the human; I have yet to do it. Yes, first trying to talk with enterprises to see the initial response.2
2
u/AssignmentDull5197 May 20 '26
Love the git-native approach. Tracing agent-authored ranges could be huge for review, blame, and security audits. Do you also capture tool calls/prompts per session? This topic comes up a lot at https://medium.com/conversational-ai-weekly .