Skip to content

pageuppeople-opensource/git-ai

 
 

Repository files navigation

PageUp Developer Setup (Internal Fork)

This is PageUp's internal fork of git-ai. All cloud telemetry, analytics, and external API calls (Sentry, PostHog, OAuth, CAS prompt upload, upgrade checks) have been disabled at compile time via the cloud feature gate. The binary runs fully offline with zero network overhead.


Install (pre-built binaries)

No Rust toolchain required. The install script downloads the correct binary for your platform, sets up PATH, creates the git shim, and configures agent hooks automatically.

macOS / Linux (WSL)

curl -fsSL https://github.com/pageuppeople-opensource/git-ai/releases/latest/download/install.sh | bash

Windows (PowerShell)

Run in an elevated (Admin) PowerShell for system-wide PATH setup, or a normal PowerShell for user-level only:

irm https://github.com/pageuppeople-opensource/git-ai/releases/latest/download/install.ps1 | iex

Restart your terminal after installation so the new PATH takes effect.

What the installer does

  1. Downloads the git-ai binary for your OS/architecture to ~/.git-ai/bin/
  2. Creates a git shim that transparently routes git commands through git-ai
  3. Creates git-og which always calls the real git (escape hatch)
  4. Adds ~/.git-ai/bin to your PATH
  5. Runs git-ai install-hooks to configure supported AI agents

After installation every git commit automatically tracks AI attribution. No per-repo setup required.

Manual install (alternative)

Download the binary for your platform from the latest release:

Platform Binary
macOS Apple Silicon (M1/M2/M3/M4) git-ai-macos-arm64
macOS Intel git-ai-macos-x64
Windows x64 git-ai-windows-x64.exe

Then place it on your PATH as git-ai and run:

git-ai install-hooks --dry-run=false

Configuring Visual Studio 2022 (and later)

Visual Studio uses its own bundled copy of git. To enable git-ai tracking, point VS to the git-ai shim instead.

Option A: VS git path override (recommended)

  1. Open Visual Studio.
  2. Go to Tools > Options > Source Control > Git Global Settings.
  3. Set Git executable path to:
    C:\Users\<you>\.git-ai\bin\git.exe
    
    (The install script placed the shim there. Replace <you> with your Windows username.)
  4. Click OK and restart Visual Studio.

Option B: System PATH (works for all VS versions)

If the VS git path setting is left empty, Visual Studio falls back to the system PATH. The install script already puts ~/.git-ai/bin at the front of your PATH, so this should work automatically. Verify with:

where.exe git
# First line should be: C:\Users\<you>\.git-ai\bin\git.exe

If the VS-bundled git still appears first, move %USERPROFILE%\.git-ai\bin earlier in your User PATH (System Settings > Environment Variables).

Verifying it works

After configuring VS, make a commit from the IDE. Then open a terminal and run:

git-ai blame <file-you-just-committed>

You should see AI attribution lines if any AI-assisted code was included.

Troubleshooting

Symptom Fix
VS ignores the custom git path Restart VS after changing the setting. Some versions cache the git location.
git.exe not found after install Ensure %USERPROFILE%\.git-ai\bin is on your PATH before other git directories.
Commits work but no AI attribution Run git-ai install-hooks --dry-run=false to ensure hooks are installed, then verify your AI agent (Copilot, Cursor, etc.) is supported.
Need to bypass git-ai temporarily Use git-og instead of git — it calls real git directly.

Building from source (optional)

Only needed if you want to modify git-ai itself. Developers who just want to use it should use the pre-built binaries above.

# Prerequisites: Rust (https://rustup.rs)
git clone https://github.com/pageuppeople-opensource/git-ai.git && cd git-ai
cargo build --release          # telemetry-free build (default)
cargo build --release --features cloud  # upstream-compatible build with telemetry

git-ai Discord

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 Windsurf Amp 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

About

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

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Rust 91.2%
  • Python 2.5%
  • TypeScript 2.3%
  • Shell 2.1%
  • Kotlin 1.0%
  • Nix 0.5%
  • Other 0.4%