git-ai

git-ai

A Git extension for tracking the AI-generated code in your repos

Stars: 1059

Visit
 screenshot

Git AI is an open source git extension that tracks AI-generated code in repositories. It automatically links AI-written lines to the agent, model, and transcripts that generated them, ensuring the intent, requirements, and architecture decisions behind the code are never lost. Git AI provides AI attribution on every commit and shows the model, agent, and session behind every line. It supports various agents and works offline without the need for per-repo setup. The tool aims to accurately track AI code without cluttering git history and provides a local-first approach. Transcripts are stored locally, in the Git AI Cloud, or in a self-hosted prompt store to keep repositories lean and free of sensitive information.

README:

git-ai

Git AI Logo

Git AI is an open source git extension that tracks AI-generated code in your repositories.

Once installed, it automatically links every AI-written line to the agent, model, and transcripts that generated it — so you never lose the intent, requirements, and architecture decisions behind your code.

AI attribution on every commit:

git commit

[hooks-doctor 0afe44b2] wsl compat check
 2 files changed, 81 insertions(+), 3 deletions(-)
you  ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ai
     6%             mixed   2%             92%

AI Blame shows the model, agent, and session behind every line:

git-ai blame /src/log_fmt/authorship_log.rs

cb832b7 (Aidan Cunniffe      2025-12-13 08:16:29 -0500  133) pub fn execute_diff(
cb832b7 (Aidan Cunniffe      2025-12-13 08:16:29 -0500  134)     repo: &Repository,
cb832b7 (Aidan Cunniffe      2025-12-13 08:16:29 -0500  135)     spec: DiffSpec,
cb832b7 (Aidan Cunniffe      2025-12-13 08:16:29 -0500  136)     format: DiffFormat,
cb832b7 (Aidan Cunniffe      2025-12-13 08:16:29 -0500  137) ) -> Result<String, GitAiError> {
fe2c4c8 (claude [session_id] 2025-12-02 19:25:13 -0500  138)     // Resolve commits to get from/to SHAs
fe2c4c8 (claude [session_id] 2025-12-02 19:25:13 -0500  139)     let (from_commit, to_commit) = match spec {
fe2c4c8 (claude [session_id] 2025-12-02 19:25:13 -0500  140)         DiffSpec::TwoCommit(start, end) => {
fe2c4c8 (claude [session_id] 2025-12-02 19:25:13 -0500  141)             // Resolve both commits
fe2c4c8 (claude [session_id] 2025-12-02 19:25:13 -0500  142)             let from = resolve_commit(repo, &start)?;...

Supported Agents

Claude Code Codex Cursor OpenCode Gemini GitHub Copilot Continue Droid Junie Rovo Dev

+ Add support for another agent

Install

Mac, Linux, Windows (WSL)

curl -sSL https://usegitai.com/install.sh | bash

Windows (non-WSL)

powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://usegitai.com/install.ps1 | iex"

That's it — no per-repo setup required. Prompt and commit as normal. Git AI tracks attribution automatically.

Our Choices

  • No workflow changes — Just prompt and commit. Git AI tracks AI code accurately without cluttering your git history.
  • "Detecting" AI code is an anti-pattern — Git AI does not guess whether a hunk is AI-generated. Supported agents report exactly which lines they wrote, giving you the most accurate attribution possible.
  • Local-first — Works 100% offline, no login required.
  • Git native and open standard — Git AI uses an open standard for tracking AI-generated code with Git Notes.
  • Transcripts stay out of Git — Git Notes link to transcripts stored locally, in the Git AI Cloud, or in a self-hosted prompt store -- keeping your repos lean, free of sensitive information, and giving you control over your data.
Solo For Teams
Solo — everything stays on your machine For teams — shared context across your team
  • AI Authorship stored in Git Notes, with pointers to transcripts stored in local SQLite
  • Transcripts only stored locally, on computer
  • Restart any transcript
  • Measure AI authorship across commits with git-ai stats
  • AI Authorship stored in Git Notes, with pointers to cloud or self-hosted transcript store with built-in access control, secret redaction, and PII filtering
  • Agents and engineers can read transcripts and summaries for any block of AI-generated code
  • Restart any transcript, by any contributor
  • Advanced cross-agent dashboards to measure AI adoption, code durability, and compare agents across your team

Click here to get early access

Understand Why with the /ask Skill

See something you don't understand? The /ask skill lets you talk to the agent that wrote the code about its instructions, decisions, and the intent of the engineer who assigned the task.

Git AI adds the /ask skill to ~/.agents/skills/ and ~/.claude/skills/ at install time, so you can invoke it from Cursor, Claude Code, Copilot, Codex, and others just by typing /ask:

/ask Why didn't we use the SDK here?

Agents with access to the original intent and source code understand the "why." Agents that can only read the code can tell you what it does, but not why:

Reading Code + Transcript (/ask) Only Reading Code (not using Git AI)
When Aidan was building telemetry, he instructed the agent not to block the exit of our CLI flushing telemetry. Instead of using the Sentry SDK directly, we came up with a pattern that writes events locally first via append_envelope(), then flushes them in the background via a detached subprocess. This keeps the hot path fast and ships telemetry async after the fact. src/commands/flush_logs.rs is a 5-line wrapper that delegates to src/observability/flush.rs (~700 lines). The commands/ layer handles CLI dispatch; observability/ handles Sentry, PostHog, metrics upload, and log processing. Parallel modules like flush_cas, flush_logs, flush_metrics_db follow the same thin-dispatch pattern.

Make Your Agents Smarter

Agents make fewer mistakes and produce more maintainable code when they understand the requirements and decisions behind the code they build on. The best way to provide this context is to give agents the same /ask tool you use yourself. Tell your agents to use /ask in plan mode:

Claude|AGENTS.md

- In plan mode, always use the /ask skill to read the code and the original transcript that generated it. Understanding intent will help you write a better plan.

AI Blame

Git AI blame is a drop-in replacement for git blame that shows AI attribution for each line. It supports all standard git blame flags.

git-ai blame /src/log_fmt/authorship_log.rs
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  133) pub fn execute_diff(
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  134)     repo: &Repository,
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  135)     spec: DiffSpec,
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  136)     format: DiffFormat,
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  137) ) -> Result<String, GitAiError> {
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  138)     // Resolve commits to get from/to SHAs
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  139)     let (from_commit, to_commit) = match spec {
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  140)         DiffSpec::TwoCommit(start, end) => {
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  141)             // Resolve both commits
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  142)             let from = resolve_commit(repo, &start)?;
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  143)             let to = resolve_commit(repo, &end)?;
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  144)             (from, to)
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  145)         }

IDE Plugins

AI blame decorations in the gutter, color-coded by agent session. Hover over a line to see the raw prompt or summary.

Supported Editors
Git AI VS Code extension showing color-coded AI blame in the gutter

Cross Agent Observability

Git AI collects cross-agent telemetry from prompt to production. Track how much AI code gets accepted, committed, through code review, and into production — so you can identify which tools and practices work best for your team.

git-ai stats --json

Learn more: Stats command reference docs

{
  "human_additions": 28,
  "mixed_additions": 5,
  "ai_additions": 76,
  "ai_accepted": 47,
  "total_ai_additions": 120,
  "total_ai_deletions": 34,
  "time_waiting_for_ai": 240,
  "tool_model_breakdown": {
    "claude_code/claude-sonnet-4-5-20250929": {
      "ai_additions": 76,
      "mixed_additions": 5,
      "ai_accepted": 47,
      "total_ai_additions": 120,
      "total_ai_deletions": 34,
      "time_waiting_for_ai": 240
    }
  }
}

For team-wide visibility, Git AI Enterprise aggregates data at the PR, repository, and organization level:

  • AI code composition — Track what percentage of code is AI-generated across your org.
  • Full lifecycle tracking — See how much AI code is accepted, committed, rewritten during code review, and deployed to production. Measure how durable that code is once it ships and whether it causes alerts or incidents.
  • Team workflows — Identify who uses background agents effectively, who runs agents in parallel, and what teams getting the most lift from AI do differently.
  • Agent readiness — Measure the effectiveness of agents in your repos. Track the impact of skills, rules, MCPs, and AGENTS.md changes across repos and task types.
  • Agent and model comparison — Compare acceptance rates and output quality by agent and model.

Get early access

Git AI Enterprise dashboard showing AI code metrics across repositories

How does Git AI work?
  • Agents report what code they wrote via pre/post edit hooks.
  • Git AI stores each edit as a checkpoint — a small diff in .git/ai/ that records whether the change is AI-generated or human-authored. Checkpoints accumulate as you work.
  • On commit, Git AI processes all checkpoints into an Authorship Log that links line ranges to agent sessions, then attaches the log to the commit via a Git Note.
  • Git AI preserves attribution across rebases, merges, squashes, stash/pops, cherry-picks, and amends by transparently rewriting Authorship Logs whenever history changes.
Git Note refs/notes/ai #<commitsha> `hooks/post_clone_hook.rs`
hooks/post_clone_hook.rs
  a1b2c3d4e5f6a7b8 6-8
  c9d0e1f2a3b4c5d6 16,21,25
---
{
  "schema_version": "authorship/3.0.0",
  "git_ai_version": "0.1.4",
  "base_commit_sha": "f4a8b2c...",
  "prompts": {
    "a1b2c3d4e5f6a7b8": {
      "agent_id": {
        "tool": "copilot",
        "model": "codex-5.2"
      },
      "human_author": "Alice Person <[email protected]>",
      "messages": [],
      "total_additions": 8,
      "total_deletions": 0,
      "accepted_lines": 3,
      "overriden_lines": 0,
      "messages_url": "https://your-prompt-store.dev/cas/a1b2c3d4..."
    },
    "c9d0e1f2a3b4c5d6": {
      "agent_id": {
        "tool": "cursor",
        "model": "sonnet-4.5"
      },
      "human_author": "Jeff Coder <[email protected]>",
      "messages": [],
      "total_additions": 5,
      "total_deletions": 2,
      "accepted_lines": 3,
      "overriden_lines": 0,
      "messages_url": "https://your-prompt-store.dev/cas/c9d0e1f2..."
    }
  }
}
 1  pub fn post_clone_hook(
 2      parsed_args: &ParsedGitInvocation,
 3      exit_status: std::process::ExitStatus,
 4  ) -> Option<()> {
 5
 6      if !exit_status.success() {
 7          return None;
 8      }
 9
10      let target_dir =
11          extract_clone_target_directory(&parsed_args.command_args)?;
12
13      let repository =
14          find_repository_in_path(&target_dir).ok()?;
15
16      print!("Fetching authorship notes from origin");
17
18      match fetch_authorship_notes(&repository, "origin") {
19          Ok(()) => {
20              debug_log("successfully fetched");
21              print!(", done.\n");
22          }
23          Err(e) => {
24              debug_log(&format!("fetch failed: {}", e));
25              print!(", failed.\n");
26          }
27      }
28
29      Some(())
30  }

The note format is defined in the Git AI Standard v3.0.0.

License

Apache 2.0

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for git-ai

Similar Open Source Tools

For similar tasks

For similar jobs