Documentation

Everything you need to install, configure, and use GitIntel.

Installation

GitIntel runs entirely on your machine. Pick the install method that works for your platform.

One-liner install

# macOS / Linux
curl -fsSL https://gitintel.com/install | sh

# Windows (PowerShell)
irm https://gitintel.com/install.ps1 | iex

Homebrew

brew install gitintel-ai/tap/gitintel

npm (any platform)

npx @gitintel-cli/gitintel

Build from source

Requires Rust 1.82+ and Git 2.30+.

git clone https://github.com/gitintel-ai/GitIntelAI.git && cd GitIntelAI
cargo build --release --manifest-path packages/cli/Cargo.toml
cp packages/cli/target/release/gitintel ~/.local/bin/

Quick Start

The full loop from AI-assisted coding to tracked commit.

1. Initialize your repo

Run this once per repository. It installs git hooks and creates a local .gitintel/ config directory.

cd your-project/
gitintel init

2. Record AI checkpoints

When your AI agent writes or modifies a file, call gitintel checkpoint to record which lines it wrote.

gitintel checkpoint \
  --agent "Claude Code" \
  --model "claude-sonnet-4-6" \
  --session-id "sess_abc123" \
  --file "src/api.ts" \
  --lines "12-45,78-103"

3. Commit normally

The post-commit hook fires automatically, builds an attribution record, and stores it in git notes.

git add src/api.ts
git commit -m "Add auth flow"

4. Query the data

gitintel stats --since 30d      # see adoption numbers
gitintel blame src/api.ts       # line-level AI/human attribution
gitintel cost --since 7d        # cost breakdown

Zero-Setup Mode

Works on any repo. No init required. Detects Co-Authored-By trailers and AI agent signatures automatically.

gitintel scan

Example output:

Scanning git history...
  Found 47 commits with AI co-author trailers
  Agents detected: Claude Code (31), Cursor (12), Copilot (4)

AI Adoption: 38.2% of commits  |  ~4,200 lines attributed

Commands Reference

gitintel scan

Zero-setup detection. Scans git history for Co-Authored-By trailers and AI agent signatures. Works on any repo without initialization.

gitintel scan

gitintel blame

Like git blame, but shows who (or what) wrote each line.

gitintel blame src/api.ts
gitintel blame src/api.ts --commit abc1234
gitintel blame src/api.ts --ai-only
gitintel blame src/api.ts --human-only

Example output:

AI Blame: src/api.ts
   1 [AI] dc69ba8  Alice Chen  export async function createUser(
   2 [AI] dc69ba8  Alice Chen    data: CreateUserInput,
   3 [AI] dc69ba8  Alice Chen  ) {
  ...
  56 [HU] dc69ba8  Alice Chen  // Hand-written validation
  57 [HU] dc69ba8  Alice Chen  function validateEmail(email: string) {
  58 [HU] dc69ba8  Alice Chen    return EMAIL_RE.test(email);
  59 [HU] dc69ba8  Alice Chen  }

Legend: [AI] AI-generated (checkpoint) · [AI*] AI-detected (Co-Authored-By) · [HU] Human-written · [MX] Mixed · [??] Unknown

gitintel stats

Shows adoption statistics for the repository.

gitintel stats                            # last 30 days (default)
gitintel stats --since 7d                 # specific time period
gitintel stats --developer alice@acme.com # per-developer
gitintel stats --format json              # JSON output
gitintel stats --format csv               # CSV output

Example output:

GitIntel Stats - last 30 days
--------------------------------------------
Commits:      47
Total Lines:  5,890
AI Lines:     2,341  (39.7%)
Human Lines:  3,549  (60.3%)

Top Agent:    Claude Code  (74% of AI lines)
Top Model:    claude-sonnet-4-6

Trend:        +8% AI adoption vs previous 30 days

gitintel cost

Shows development cost broken down by commit, branch, developer, or time period.

gitintel cost --since 7d                   # weekly summary
gitintel cost --commit abc1234def5678      # specific commit
gitintel cost --branch feature/oauth       # feature branch
gitintel cost --developer alice@acme.com   # per developer
gitintel cost --since 30d --format json    # JSON output

Example output:

Cost Summary: last 7d
------------------------------------------------------
Total Spend:     $47.23
Commits:         142
Avg Cost/Commit: $0.33
AI Code Lines:   7,923 / 18,340 (43.2%)
------------------------------------------------------
By Developer:
  alice@acme.com     $18.40  (38 commits, 61.0% AI)
  bob@acme.com       $14.72  (52 commits, 34.5% AI)
  carol@acme.com     $14.11  (52 commits, 40.1% AI)

gitintel context

Generates and optimizes CLAUDE.md context files to reduce token burn.

gitintel context init              # generate CLAUDE.md from repo analysis
gitintel context init --force      # overwrite existing
gitintel context optimize          # preview what would be pruned
gitintel context optimize --apply  # apply optimizations
gitintel context diff              # show token delta

gitintel memory

Manages a persistent key-value memory store for codebase facts.

gitintel memory add \
  --key "auth-pattern" \
  --value "All protected routes use requireAuth() middleware" \
  --category "architecture"

gitintel memory get auth-pattern
gitintel memory list --category conventions
gitintel memory prune --unused-days 30
gitintel memory export --format markdown

Attribution Standard

GitIntel uses an open, git-native format for recording AI code authorship. Attribution data is stored as git notes at refs/ai/authorship — a standard git mechanism that travels with your repo on push/fetch/clone.

Reading attribution without GitIntel

Any tool can read attribution data using plain git commands:

# Show attribution for the latest commit
git notes --ref=refs/ai/authorship show HEAD

# List all commits with attribution notes
git notes --ref=refs/ai/authorship list

Schema (gitintel/1.0.0)

The attribution YAML record stored per commit:

schema_version: gitintel/1.0.0
commit: b7d1e94f3a2c8e91d0f4b6a2c3e5d7f9b1a3c5e7
author_email: alice@acme.com
authored_at: 2026-03-03T14:30:00Z

agent_sessions:
  - session_id: sess_abc123
    agent: "Claude Code"
    model: "claude-sonnet-4-6"
    vendor: anthropic
    tokens:
      input: 1240
      output: 890
    cost:
      usd: 0.0234
    files:
      "src/auth/login.ts":
        total_lines: 120
        ai_ranges: [[12, 45], [78, 103]]
        human_ranges: [[1, 11], [46, 77], [104, 120]]

summary:
  total_files_changed: 1
  total_lines_added: 120
  ai_lines: 60
  human_lines: 60
  ai_pct: 50.0
  total_cost_usd: 0.0234
  primary_agent: "Claude Code"

Key properties

Agent Integrations

Claude Code

Add this to your project's CLAUDE.md for automatic checkpointing:

# In CLAUDE.md:
After writing or modifying any file, call:
gitintel checkpoint \
  --agent "Claude Code" \
  --model "$CLAUDE_MODEL" \
  --session-id "$CLAUDE_SESSION_ID" \
  --file "$FILE_PATH" \
  --lines "$LINE_RANGE"

For automatic cost tracking via OpenTelemetry:

# Add to ~/.bashrc or ~/.zshrc
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc

Cursor

Run from Cursor's integrated terminal after an AI edit:

gitintel checkpoint \
  --agent "Cursor" \
  --model "claude-3-5-sonnet" \
  --session-id "cursor-$(date +%s)" \
  --file "src/components/Button.tsx" \
  --lines "1-80"

GitHub Copilot

Checkpoint files at commit time rather than per-suggestion:

gitintel checkpoint \
  --agent "GitHub Copilot" \
  --model "copilot-gpt-4" \
  --session-id "copilot-$(git rev-parse --short HEAD)" \
  --file "src/utils/formatDate.ts" \
  --lines "1-45"

Any other agent

The --agent flag is a free-form string. ChatGPT, Gemini CLI, local models — any agent works:

gitintel checkpoint \
  --agent "Gemini CLI" \
  --model "gemini-2.5-pro" \
  --session-id "my-session-$(date +%Y%m%d-%H%M%S)" \
  --file "src/api/handler.go" \
  --lines "25-100"

Team Setup

Sharing attribution via git notes

By default, git notes do not push/fetch automatically. Configure your remote to sync attribution data:

# Configure fetch to pull attribution notes
git config --add remote.origin.fetch '+refs/ai/authorship/*:refs/ai/authorship/*'

# Configure push to include attribution notes
git config --add remote.origin.push 'refs/ai/authorship/*'

# Push attribution for the current branch
git push origin refs/ai/authorship/*

Once configured, git push and git fetch will automatically sync attribution data. Team members running gitintel stats or gitintel blame will see attribution for all commits.

Configuration

Checkpoint flags

FlagRequiredDescription
--agentYesAgent name
--modelYesModel identifier
--session-idYesUnique session ID (any string)
--fileYesFile path (relative to repo root)
--linesYesLine ranges, e.g. "1-50" or "1-30,55-80"
--tokens-inNoInput tokens consumed
--tokens-outNoOutput tokens produced
--cost-usdNoCost in USD
--transcript-refNoSHA or URL of session transcript

Cloud sync (optional)

GitIntel can sync attribution and cost data to a central API server. Off by default.

gitintel config --set cloudSync.enabled=true
gitintel config --set cloudSync.endpoint=https://your-server.example.com/api/v1
gitintel config --set cloudSync.apiKey=your-api-key

gitintel sync             # push all local data
gitintel sync --dry-run   # preview what would be synced

OTel cost tracking

Claude Code exports native OpenTelemetry metrics. GitIntel captures them automatically:

# Add to your shell profile
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc

Captured metrics include claude_code.token.usage, claude_code.cost.usage, and claude_code.commit.count. GitIntel correlates sessions to commits by timestamp.

Troubleshooting

gitintel blame shows [??] for all lines

The file path in the checkpoint did not match the path in git notes. Use the same relative path for --file and the argument to gitintel blame.

Checkpoints exist but stats show 0% AI

The post-commit hook may not be executing. Verify:

gitintel hooks status
git config --global core.hooksPath
gitintel hooks run post-commit   # manually trigger

Windows: build fails with os error 32

Windows-specific file lock during compilation. Force single-threaded build:

cargo build --jobs 1 --manifest-path packages/cli/Cargo.toml

FAQ

Does GitIntel change how I use git?

No. You still run git commit, git push, etc. as normal. The only new command is gitintel checkpoint, which your AI agent can call on your behalf.

Does GitIntel track my AI prompts or code content?

No. GitIntel tracks line number ranges, token counts, and cost metadata only. Code content and prompts are never read or stored.

Can I strip attribution before open-sourcing?

Yes. Git notes are stored separately from commit history:

git notes --ref=refs/ai/authorship remove \
  --ignore-missing $(git log --format="%H")

Can I use multiple AI agents in the same repo?

Yes. Each checkpoint carries its own --agent and --model. Attribution logs support multi-agent commits. gitintel stats breaks down adoption per agent.

What if I forget to checkpoint before committing?

The commit still works. Lines not covered by a checkpoint are attributed as Human. Best practice is to checkpoint before committing.

Found an issue? Open an issue on GitHub or see the contributing guide.