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)?;...Mac, Linux, Windows (WSL)
curl -sSL https://usegitai.com/install.sh | bashWindows (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.
- 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.
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. |
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.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.rscb832b7 (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) }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 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 --jsonLearn 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.mdchanges across repos and task types. - Agent and model comparison — Compare acceptance rates and output quality by agent and model.
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` |
|
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.
Apache 2.0


