Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

whogitit is a tool for tracking AI-generated code at line-level granularity. It tells you exactly which lines were written by AI, which were modified by humans, and what prompts generated them.

Why whogitit?

As AI coding assistants become integral to development workflows, understanding the origin of code becomes increasingly important:

  • Transparency: Know exactly what percentage of your codebase was AI-generated
  • Accountability: Track which prompts led to specific code changes
  • Code Review: Quickly identify AI-generated sections that may need extra scrutiny
  • Compliance: Meet organizational requirements for AI usage disclosure
  • Learning: Understand how AI suggestions were modified and improved by humans

Key Features

  • Line-level attribution - Track whether each line is AI-generated, human-modified, or original
  • Prompt preservation - Store the prompts that generated code alongside commits
  • Three-way diff analysis - Accurate attribution even when you edit AI code before committing
  • Git-native storage - Uses git notes that travel with your repository
  • Claude Code integration - Automatic capture via hooks
  • GitHub Action - PR comments showing AI attribution summaries with prompts
  • Privacy protection - Automatic redaction of API keys, passwords, and sensitive data
  • Data retention policies - Configurable age limits and auto-purge for compliance
  • Audit logging - Track deletions, exports, and configuration changes
  • Export capabilities - Bulk export attribution data as JSON or CSV

How It Works

whogitit uses a dual-hook capture system integrated with Claude Code:

  1. PreToolUse Hook - Captures the file state before any AI edit
  2. PostToolUse Hook - Records the change and extracts the prompt from the session transcript

When you commit, whogitit performs a three-way diff analysis comparing:

  • The original content (before AI edits)
  • The AI-generated content (after each AI edit)
  • The final committed content (after any human modifications)

This analysis determines the attribution for each line, which is stored as a git note attached to the commit.

Attribution Types

SymbolSourceDescription
AIGenerated by AI, unchanged
AIModifiedGenerated by AI, then edited by human
+HumanAdded by human after AI edits
OriginalExisted before AI session
?UnknownCould not determine source

Next Steps