Getting Started

git-ai
Save your prompts and keep track of code generated by AI.
Why git-ai
?
git blame
attributes all code to the commit's author, even when much of it is AI-generated.
⭐️Git-native - enhanced authorship and prompt transcripts are stored in git notes and linked to commit hashes.
🫡Simple and explicit - no file system monitors, keyloggers or batch-write heuristics. Supported Agents call git-ai
after writing code, using hooks or extensions.
🤞Emerging Standard - developers have tool choice, and they're likely using a mix of Claude Code, Codex, Cursor, GitHub Copilot, etc.
⚡️Fast + Cross Platform - implemented in Rust, as fast as git status
and leverages native Git APIs
Install
To install (or update) git-ai
run the install script for your platform. The script will automatically setup everything you need, including integrations with coding agents and IDEs.
Mac, Linux, Windows (WSL)
curl -sSL https://raw.githubusercontent.com/acunniffe/git-ai/main/install.sh | bash
Windows (non-WSL)
git-ai
support for non-WSL Windows is currently experimental. Please file issues if you encounter any issues using git-ai
on Windows.
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/acunniffe/git-ai/main/install.ps1 | iex"
Agent Support
git-ai
automatically sets up all supported agent hooks using the git-ai install-hooks
command
Agent/IDE | Authorship | Prompts |
---|---|---|
Cursor >1.7 | ✅ | ✅ |
Claude Code | ✅ | ✅ |
GitHub Copilot in VSCode via Extension | ✅ | ✅ |
OpenAI Codex (waiting on openai/codex #2904) | ||
Sourcegraph Cody + Amp | ||
Windsurf | ||
RovoDev CLI | ||
your agent here |
Want to add yours? All PRs welcome! Add documentation to
docs/agent-support/
How it works
git-ai
is a git CLI wrapper. It proxies commands, args, and flags to your git
binary. You and your IDEs won't notice the difference, but all your code will be annotated with AI Authorship.
Internally, git-ai
creates checkpoints to establish authorship of specific lines of code. Agents call git-ai checkpoint
before they write to the file system to mark any previous edits as yours. After they write to the file system, they call checkpoint agent-name ...
to mark their contributions as AI-generated and to save the associated propmpts. These checkpoints work similarly to how IDEs handle local history and they do not leave your machine. When you commit, git-ai
compresses and packages the final authorship log and prompt transcripts into a git note attached to the commit.
git-ai
commands
All git-ai
commands follow this pattern:
git-ai <command> [options]
stats
Show AI authorship statistics for a commit. Displays how much code was written by humans vs AI.
# Show stats for current HEAD
git-ai stats
# Show stats for specific commit
git-ai stats <commit-sha>
# Output in JSON format
git-ai stats --json
git-ai stats <commit-sha> --json
Options:
<commit-sha>
- Optional commit SHA (defaults to HEAD)--json
- Output statistics in JSON format
blame
Enhanced version of git blame
that shows AI authorship attribution alongside traditional git blame.
git-ai blame <file>
Arguments:
<file>
- Path to the file to blame (required)
Options:
Mostly API Compatible, supports same options as git blame
.
install-hooks
Automatically configure Claude Code, Cursor and GitHub Copilot to send authorship information to the git-ai
binary
git-ai install-hooks
git
proxy behavior
After the git-ai
binary is installed and put on the $PATH
, it handles all invocations of git
and git-ai
.
git-ai
aims to be a transparent proxy with an unnoticeable performance impact. We reguarly run builds against git
's unit tests to maximize cross platform compatibility and test the performance of our AI checkpointing code.
There two behavior changes git-ai
introduces:
- After commits,
git-ai
adds an AI Authorship log linked to the commit innotes/ai
and print this visualization for developers:
- In Git, notes do not sync by default.
git-ai
will append the refspec fornotes/ai
tofetch
/push
calls so they are always synced.
Known limitations
- Tab completions (from AI or traditional intellisense) are currently considered human edits.
- Authorship logs will not survive rebase, unless the rebase operation is run without git-ai (for ex, if the rebase is done on GitHub, the authorship logs from the affected commits will be quietly lost).
- AI deletions are not measured, only AI Additions and Total AI Line Count in the repo
Developing git-ai
git clone https://github.com/acunniffe/git-ai.git
cd git-ai
cargo build
cargo test
Putting a development build of git-ai
on your path
sh scripts/dev-symlinks.sh
task debug:local
you'll need to install taskfile_
License
MIT