Skip to content

add codeline agent attribution for manual commits#101

Merged
gtrrz-victor merged 32 commits intomainfrom
soph/agent-attribution
Jan 28, 2026
Merged

add codeline agent attribution for manual commits#101
gtrrz-victor merged 32 commits intomainfrom
soph/agent-attribution

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Jan 23, 2026

This adds new fields to the metadata.json:

    "initial_attribution": {
      "calculated_at": "2026-01-23T14:30:00Z",
      "agent_lines": 142,
      "human_added": 12,
      "human_modified": 6,
      "human_removed": 3,
      "total_committed": 154,
      "agent_percentage": 92.2
    }

This is done by comparing the shadow branch against the commit that was made. Any change not in the shadow branch was made by the user. Based on that we calculate a percentage.


Note

Introduces commit-time attribution metrics and prompt-time tracking to quantify agent vs. human contributions in manual-commit flow.

  • Adds initial_attribution to metadata.json with fields like agent_lines, human_added, human_modified, human_removed, total_committed, and agent_percentage; timestamps UTC
  • Implements attribution calculation by diffing base → shadow (agent work) and shadow → head (post-checkpoint user edits), excluding binary files; retains attribution across multi-session merges
  • Captures per-prompt user edits via new session state (PromptAttributions, PendingPromptAttribution) computed at prompt start from the worktree; stored on checkpoint save and cleared after condensation
  • Extends manual-commit strategy to compute and persist attribution during condensation; logs debug info; converts session state to/from strategy types
  • Adds comprehensive unit/integration tests (including deletion-only, no double-counting, staging vs worktree) and architecture docs; updates go.mod with go-diff dependency

Written by Cursor Bugbot for commit 6faf363. This will update automatically on new commits. Configure here.

@Soph Soph requested a review from a team as a code owner January 23, 2026 16:05
Copilot AI review requested due to automatic review settings January 23, 2026 16:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds line-level agent attribution tracking for manual commits by comparing the shadow branch (agent work) against HEAD (what was actually committed). The calculated metrics show how much of the committed code came from the agent unchanged versus human edits, including an agent percentage.

Changes:

  • Adds InitialAttribution struct to capture line-level metrics (agent lines, human added/modified/removed, total committed, agent percentage)
  • Implements diffing logic using github.com/sergi/go-diff/diffmatchpatch to compare checkpoint tree vs committed tree
  • Integrates attribution calculation into the manual-commit condensation flow

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/entire/cli/checkpoint/checkpoint.go Defines InitialAttribution struct and adds it to WriteCommittedOptions and CommittedMetadata
cmd/entire/cli/checkpoint/committed.go Passes InitialAttribution through to metadata.json during checkpoint write
cmd/entire/cli/strategy/manual_commit_attribution.go Implements CalculateAttribution with line-level diff logic, binary file handling, and edge case handling
cmd/entire/cli/strategy/manual_commit_attribution_test.go Unit tests for diffLines, countLinesStr, and attribution calculation edge cases
cmd/entire/cli/strategy/manual_commit_condensation.go Integrates attribution calculation into CondenseSession by comparing shadow tree to HEAD tree
cmd/entire/cli/strategy/manual_commit_test.go Integration test verifying attribution is calculated and written to metadata.json

@Soph Soph force-pushed the soph/agent-attribution branch from 3f3384a to 164ceba Compare January 23, 2026 16:16
Copilot AI review requested due to automatic review settings January 23, 2026 17:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

@Soph Soph marked this pull request as draft January 23, 2026 18:02
Copilot AI review requested due to automatic review settings January 23, 2026 18:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

@Soph
Copy link
Collaborator Author

Soph commented Jan 23, 2026

bugbot run

Copilot AI review requested due to automatic review settings January 23, 2026 21:42
@Soph Soph marked this pull request as ready for review January 23, 2026 21:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings January 23, 2026 22:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings January 23, 2026 22:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Soph and others added 8 commits January 26, 2026 18:41
Entire-Checkpoint: 646566222911
Entire-Checkpoint: ea217859e24e
Entire-Checkpoint: 915ce19ee748
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Entire-Checkpoint: aa778e725b89
Entire-Checkpoint: b59708d80b7f
Entire-Checkpoint: cf94b61f8eef
Copilot AI review requested due to automatic review settings January 26, 2026 17:43
@Soph Soph force-pushed the soph/agent-attribution branch from c65f190 to ce6c7cb Compare January 26, 2026 17:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Soph added 2 commits January 26, 2026 21:54
Entire-Checkpoint: e577a6f39913
Entire-Checkpoint: e577a6f39913
Copilot AI review requested due to automatic review settings January 27, 2026 09:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

…pturing the design

Entire-Checkpoint: 47db6946d2e9
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Entire-Checkpoint: 727155f451db
Copilot AI review requested due to automatic review settings January 27, 2026 12:15
Entire-Checkpoint: e14c4e9a2298
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Soph added 2 commits January 27, 2026 13:27
Entire-Checkpoint: 7a0f7b5d6c56
Entire-Checkpoint: 8533ba3a79ea
@gtrrz-victor gtrrz-victor merged commit 9292912 into main Jan 28, 2026
4 checks passed
@gtrrz-victor gtrrz-victor deleted the soph/agent-attribution branch January 28, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants